-
Notifications
You must be signed in to change notification settings - Fork 14
/
Makefile
73 lines (59 loc) · 1.31 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
project_dir := .
# Reformat code
.PHONY: reformat
reformat:
@poetry run black $(project_dir)
@poetry run ruff check $(project_dir) --fix
# Lint code
.PHONY: lint
lint: reformat
@poetry run mypy $(project_dir)
# Make database migration
.PHONY: migration
migration:
@poetry run alembic revision \
--autogenerate \
--rev-id $(shell python migrations/_get_revision_id.py) \
--message $(message)
# Apply database migrations
.PHONY: migrate
migrate:
@poetry run alembic upgrade head
# Run bot
.PHONY: run
run:
@poetry run python -O -m $(shell poetry version | awk '{print $$1}')
# Initialize .ftl files
.PHONY: init-ftl
init-ftl:
@chmod +x ./scripts/extract_ftl.sh \
&& ./scripts/extract_ftl.sh
# Build bot image
.PHONY: app-build
app-build:
@docker compose build
# Run bot database containers
.PHONY: app-run-db
app-run-db:
@docker compose up -d --remove-orphans postgres redis
# Run bot in docker container
.PHONY: app-run
app-run:
@docker compose stop
@docker compose up -d --remove-orphans
# Stop docker containers
.PHONY: app-stop
app-stop:
@docker compose stop
# Down docker containers
.PHONY: app-down
app-down:
@docker compose down
# Destroy docker containers
.PHONY: app-destroy
app-destroy:
@docker compose down -v --remove-orphans
# Show bot logs
.PHONY: app-logs
app-logs:
@docker compose logs -f bot