-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathMakefile
72 lines (54 loc) · 1.42 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
DC = docker compose
EXEC = docker exec -it
ENV = --env-file .env
BOT_FILE = dc/bot.yaml
DB_FILE = dc/db.yaml
BOT_CONTAINER = bot
DB_CONTAINER = postgres
# Replace with your own values
POSTGRES_USER = POSTGRES_USER
POSTGRES_DB = POSTGRES_DB
.PHONY: bot
bot:
$(DC) -f $(BOT_FILE) $(ENV) up --build -d
.PHONY: bot-down
bot-down:
$(DC) -f $(BOT_FILE) $(ENV) down --remove-orphans
.PHONY: bot-exec
bot-exec:
$(EXEC) $(BOT_CONTAINER) bash
.PHONY: bot-logs
bot-logs:
$(DC) -f $(BOT_FILE) $(ENV) logs -f
.PHONY: create-superuser
create-superuser:
$(EXEC) $(BOT_CONTAINER) bash -c "python manage.py createsuperuser"
.PHONY: make-migrations
make-migrations:
$(EXEC) $(BOT_CONTAINER) bash -c "python manage.py makemigrations"
.PHONY: migrate
migrate:
$(EXEC) $(BOT_CONTAINER) bash -c "python manage.py migrate"
.PHONY: collectstatic
collectstatic:
$(EXEC) $(BOT_CONTAINER) bash -c "python manage.py collectstatic --noinput"
.PHONY: db
db:
$(DC) -f $(DB_FILE) $(ENV) up --build -d
.PHONY: db-down
db-down:
$(DC) -f $(DB_FILE) $(ENV) down --remove-orphans
.PHONY: db-exec
db-exec:
$(EXEC) $(DB_CONTAINER) psql -U $(POSTGRES_USER) -d $(POSTGRES_DB)
.PHONY: db-logs
db-logs:
$(DC) -f $(DB_FILE) $(ENV) logs -f
.PHONY: all
all:
$(DC) -f $(DB_FILE) $(ENV) up --build -d
$(DC) -f $(BOT_FILE) $(ENV) up --build -d
.PHONY: all-down
all-down:
$(DC) -f $(DB_FILE) $(ENV) down --remove-orphans
$(DC) -f $(BOT_FILE) $(ENV) down --remove-orphans