/
Makefile
55 lines (38 loc) · 1.38 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
ENV_FILE := $(or $(ENV_FILE), .env.development)
include $(ENV_FILE)
export $(shell sed 's/=.*//' $(ENV_FILE))
export TAG=$(shell git rev-parse --short HEAD)
install:
./scripts/install.sh
migrate:
./scripts/migrate.sh
test: migrate
. .venv/bin/activate; python3 -m pytest
lint:
. .venv/bin/activate; mypy app/
start: migrate
. .venv/bin/activate; uvicorn --host 0.0.0.0 --port $(PORT) app.main:api
seed: migrate
. .venv/bin/activate; python3 -m app.seed
start_local_db:
kubectl apply -f ./k8s/shopping-cart-common/secret.yml
kubectl apply -f ./k8s/shopping-cart-db/deployment.yml
(mkdir -p /tmp/shopping-cart/data || true) && kubectl apply -f ./k8s/shopping-cart-db/persistence.local.yml
connect_localhost_to_remote_db:
kubectl port-forward svc/shopping-cart-db 5432:5432
debug_local_db:
kubectl run cart-db-debug --rm -i --tty --image=postgres:11.5-alpine -- \
psql -h shopping-cart-db --username $(POSTGRES_USER) --password $(POSTGRES_PASS) $(POSTGRES_DB)
stop_local_db:
kubectl delete -f ./k8s/shopping-cart-common/secret.yml
kubectl delete -f ./k8s/shopping-cart-db/deployment.yml
kubectl delete -f ./k8s/shopping-cart-db/persistence.local.yml
build_image:
./scripts/build-image.sh
debug_image:
./scripts/debug-image.sh
push_image:
./scripts/push-image.sh
deploy: install lint test build_image push_image
clean:
rm -rf .venv build/ dist/ *.egg-info .pytest_cache/ bin/*