-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
47 lines (39 loc) · 1.11 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
.SILENT:
.PHONY: help
help:
@awk 'BEGIN {FS = ":.*?##"; printf "Usage:\n make \033[36m<target>\033[0m\n"; cmd=""; desc=""} \
{if ($$0 ~ /^##/) { \
if (desc != "") desc = desc" "; \
desc = desc substr($$0, 3) \
} \
else if ($$0 ~ /^[a-zA-Z_][a-zA-Z0-9_-]*:/) { \
if (desc != "") { \
sub(/:.*/, "", $$1); \
gsub(/^[ \t]+|[ \t]+$$/, "", desc); \
printf " \033[36m%-20s\033[0m %s\n", $$1, desc; \
desc = ""; \
} \
}}' $(MAKEFILE_LIST)
PORT ?= 8000
HOST ?= 127.0.0.1
## Run server
run:
. ./.env && uvicorn src.main:app --reload --port $(PORT) --host $(HOST)
## Create or update migrations
migrate:
alembic revision --autogenerate -m "$(m)"
## Apply migrations to DB
migrate-up:
alembic upgrade head
## Create database dump
dump:
. ./.env && sudo -u postgres pg_dump --dbname=simple_store > db_dumps/$(name).sql
## Build docker image
docker-build:
sudo docker build -t workaccpy/simple_store:latest -f Dockerfile .
## Push docker image
docker-push:
sudo docker push workaccpy/simple_store:latest
## Run app in docker
docker-run:
sudo docker run --network=host --env-file=.env workaccpy/simple_store:latest