-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose-prod.yml
84 lines (79 loc) · 1.94 KB
/
docker-compose-prod.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
version: "3.9"
services:
redis:
image: redis
env_file:
- .env
networks:
- back
ports:
- "${REDIS_PORT}:${REDIS_PORT}"
restart: unless-stopped
command: redis-server --requirepass ${REDIS_PASSWORD}
db:
image: postgres
volumes:
- ./docker/data/db:/var/lib/postgresql/data
environment:
- POSTGRES_PASSWORD=${POSTGRES_PASSWORD}
- POSTGRES_USER=${POSTGRES_USERNAME}
- POSTGRES_DB=${POSTGRES_NAME}
ports:
- "${POSTGRES_SERVICE_PORT}:${POSTGRES_SERVICE_PORT}"
networks:
- back
restart: unless-stopped
asgiserver:
build:
context: .
dockerfile: Dockerfile
working_dir: /app/
command:
- "/bin/sh"
- "-c"
- "python manage.py migrate && daphne -b 0.0.0.0 -p $$DAPHNE_PORT server.asgi:application"
ports:
- "${DAPHNE_PORT}:${DAPHNE_PORT}"
env_file:
- .env
networks:
- back
depends_on:
- redis
- db
restart: unless-stopped
worker:
build:
context: .
dockerfile: Dockerfile
command: bash -c "python manage.py migrate && python manage.py runworker game_engine"
env_file:
- .env
networks:
- back
depends_on:
- redis
- db
restart: unless-stopped
nginx:
build:
context: .
dockerfile: ./docker/nginx/Dockerfile
networks:
- back
ports:
- "${NGINX_HTTP_PORT}:${NGINX_HTTP_PORT}"
env_file:
- .env
depends_on:
- asgiserver
volumes:
- ./docker/nginx/templates:/etc/nginx/templates
- ./docker/data/nginx/logs:/var/log/nginx
restart: unless-stopped
#command:
# - "/bin/sh"
# - "-c"
# - "envsubst '$$NGINX_HOST $$NGINX_HTTP_PORT $$DAPHNE_PORT' < /etc/nginx/templates/service.conf.template > /etc/nginx/conf.d/default.conf & nginx -g 'daemon off;' & while :; do sleep 12h & wait $${!}; nginx -s reload; done & nginx -g 'daemon off;'"
networks:
back: