-
Notifications
You must be signed in to change notification settings - Fork 2
/
Makefile
46 lines (38 loc) · 1008 Bytes
/
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
DOCKER_REVISION ?= testing-$(USER)
DOCKER_TAG = docker-push.ocf.berkeley.edu/ocfapi:$(DOCKER_REVISION)
HOST = 127.0.0.1
PORT = 8001
.PHONY: cook-image
cook-image:
docker build --pull -t $(DOCKER_TAG) .
.PHONY: push-image
push-image:
docker push $(DOCKER_TAG)
venv: | venv/pyvenv.cfg
venv/pyvenv.cfg: requirements.txt requirements-dev.txt
python3 -m venv venv && \
chmod u+x venv/bin/activate && \
. venv/bin/activate && \
pip install --upgrade "pip>=20.3" && \
pip install -r requirements.txt -r requirements-dev.txt && \
pre-commit install
.PHONY: dev
dev: venv
@. venv/bin/activate && \
cd app && \
python -m uvicorn main:app --reload --host $(HOST) --port $(PORT)
.PHONY: test
test: venv
@. venv/bin/activate && \
cd app && \
python -m pytest && \
cd .. && \
venv/bin/check-requirements
.PHONY: update-requirements
update-requirements: venv
@venv/bin/upgrade-requirements
@sed -i 's/^ocflib==.*/ocflib/' requirements.txt
@make venv
.PHONY: lint
lint: venv
@venv/bin/pre-commit