-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
48 lines (40 loc) · 1.27 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
.PHONY: help run_dev python_build sort_imports docker_build
VERSION?=$(shell cat ./VERSION)
export VERSION
IMAGE_NAME?=me-model-analysis
define HELPTEXT
Makefile usage
Targets:
python_build Build python package.
sort_imports Sort imports in python modules.
run_dev Run development instance of the backend.
docker_build Build dev backend docker image.
endef
export HELPTEXT
help:
@echo "$$HELPTEXT"
venv:
python3 -m venv $@
venv/bin/pip install pycodestyle pydocstyle pylint isort codespell setuptools
venv/bin/pip install -e .
python_build: | venv
@venv/bin/codespell me_model_analysis
@venv/bin/pycodestyle me_model_analysis
@venv/bin/pydocstyle me_model_analysis
@venv/bin/isort --check-only --line-width 100 me_model_analysis
@venv/bin/pylint me_model_analysis
@venv/bin/python setup.py sdist
sort_imports: | venv
@venv/bin/isort --line-width 100 me_model_analysis
docker_build:
docker build -t $(IMAGE_NAME):dev \
--build-arg VERSION=$(VERSION) \
.
run_dev: docker_build
docker run --rm -it \
-e DEBUG=True \
-e ALLOWED_ORIGIN=http://localhost:8080 \
-v $$(pwd)/me_model_analysis:/usr/local/lib/python3.12/site-packages/me_model_analysis \
-v $$(pwd)/models:/opt/me-model-analysis/models \
-p 8000:8080 \
$(IMAGE_NAME):dev