generated from ukwhatn/fastapi-template
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
83 lines (61 loc) · 1.87 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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
ENV ?= "dev"
POETRY_GROUPS = "discord,db,dev"
ifeq ($(ENV), prod)
COMPOSE_YML := compose.prod.yml
else
COMPOSE_YML := compose.dev.yml
endif
build:
docker compose -f $(COMPOSE_YML) build
build\:no-cache:
docker compose -f $(COMPOSE_YML) build --no-cache
up:
docker compose -f $(COMPOSE_YML) up --build -d
down:
docker compose -f $(COMPOSE_YML) down
reload:
docker compose -f $(COMPOSE_YML) build
docker compose -f $(COMPOSE_YML) down
docker compose -f $(COMPOSE_YML) up -d
reset:
docker compose -f $(COMPOSE_YML) down --volumes --remove-orphans --rmi all
logs:
docker compose -f $(COMPOSE_YML) logs -f
logs\:once:
docker compose -f $(COMPOSE_YML) logs
ps:
docker compose -f $(COMPOSE_YML) ps
pr\:create:
git switch develop
git push
gh pr create --base main --head $(shell git branch --show-current)
gh pr view --web
deploy\:prod:
make build ENV=prod
make reload ENV=prod
poetry\:install:
pip install poetry
poetry install --with $(group)
poetry\:add:
poetry add --group=$(group) $(packages)
make poetry:lock
poetry\:lock:
poetry lock --no-update
poetry\:update:
poetry update --with $(group)
poetry\:reset:
poetry env remove $(which python)
poetry install
dev\:setup:
poetry install --with $(POETRY_GROUPS)
db\:revision\:create:
docker compose -f $(COMPOSE_YML) build db-migrator
docker compose -f $(COMPOSE_YML) run --rm db-migrator /bin/bash -c "alembic revision --autogenerate -m '${NAME}'"
db\:migrate:
docker compose -f $(COMPOSE_YML) build db-migrator
docker compose -f $(COMPOSE_YML) run --rm db-migrator /bin/bash -c "alembic upgrade head"
envs\:setup:
cp envs/discord.env.example envs/discord.env
cp envs/db.env.example envs/db.env
cp envs/sentry.env.example envs/sentry.env
PHONY: build up down logs ps pr\:create deploy\:prod poetry\:install poetry\:add poetry\:lock poetry\:update poetry\:reset dev\:setup db\:revision\:create db\:migrate envs\:init