-
Notifications
You must be signed in to change notification settings - Fork 4
/
docker-compose.yml
85 lines (77 loc) · 1.78 KB
/
docker-compose.yml
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
84
85
version: "3.8"
volumes:
back_static:
services:
db:
image: postgres:14
env_file:
- .env
networks:
- network-bot
volumes:
- ./database/pgdata:/var/lib/postgresql/data
restart: always
healthcheck:
test: [ "CMD-SHELL", "sh -c 'pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB'" ]
interval: 5s
timeout: 5s
retries: 5
django_project:
build:
context: .
command: >
sh -c "python django_app.py makemigrations &&
python django_app.py migrate &&
python django_app.py collectstatic --noinput &&
cp -r ./admin_panel/collected_static /backend_static &&
cp -r ./admin_panel/static /backend_static &&
gunicorn --bind 0.0.0.0:8000 admin_panel.django_settings.wsgi:application --chdir=/app/admin_panel"
networks:
- network-bot
env_file:
- .env
depends_on:
db:
condition: service_healthy
volumes:
- back_static:/backend_static
- ./database/media:/app/admin_panel/media
restart: always
redis:
image: redis:alpine
env_file:
- .env
networks:
- network-bot
restart: always
bot:
build:
context: .
command: sh -c "while ! nc -z django_project 8000; do sleep 1; done && python bot.py"
networks:
- network-bot
env_file:
- .env
depends_on:
- db
- django_project
- redis
volumes:
- ./database/media:/app/admin_panel/media
restart: always
nginx:
image: nginx:1.22.1
ports:
- "80:80"
networks:
- network-bot
volumes:
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- back_static:/backend_static
- ./database/media:/media
depends_on:
- django_project
restart: always
networks:
network-bot:
driver: bridge