-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
65 lines (54 loc) · 1.6 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
.PHONY: all test setup hooks install linter pytest wheel image run start docs
all: install test
test: linter pytest
LATEST = $(shell git describe --tags $(shell git rev-list --tags --max-count=1))
PWD = $(shell pwd)
setup:
# install meta requirements system-wide
@ echo installing requirements; \
pip --disable-pip-version-check install --force-reinstall -r requirements.txt; \
hooks:
# install pre-commit hooks when not in CI
@ if [ -z "$$CI" ]; then \
pre-commit install; \
fi; \
install: setup hooks
# install packages from lock file in local virtual environment
@ echo installing package; \
pdm install-all; \
linter:
# run the linter hooks from pre-commit on all files
@ echo linting all files; \
pdm lint; \
pytest:
# run the pytest test suite with all tests
@ echo running all tests; \
pdm test; \
wheel:
# build the python package
@ echo building wheel; \
pdm wheel; \
image:
# build the docker image
@ echo building docker image mex-backend:${LATEST}; \
export DOCKER_BUILDKIT=1; \
docker build \
--tag rki/mex-backend:${LATEST} \
--tag rki/mex-backend:latest .; \
run: image
# run the service as a docker container
@ echo running docker container mex-backend:${LATEST}; \
docker run \
--env MEX_BACKEND_HOST=0.0.0.0 \
--publish 8080:8080 \
rki/mex-backend:${LATEST}; \
start: image
# start the service using docker compose
@ echo start mex-backend:${LATEST} with compose; \
export DOCKER_BUILDKIT=1; \
export COMPOSE_DOCKER_CLI_BUILD=1; \
docker compose up --remove-orphans; \
docs:
# use sphinx to auto-generate html docs from code
@ echo generating docs; \
pdm doc; \