-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.prod.yml
117 lines (110 loc) · 2.83 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
version: '3.8'
services:
db:
image: postgres:13
volumes:
- postgres_data:/var/lib/postgresql/data
environment:
- POSTGRES_DB=${DB_NAME}
- POSTGRES_USER=${DB_USER}
- POSTGRES_PASSWORD=${DB_PASSWORD}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER} -d ${DB_NAME}"]
interval: 10s
timeout: 5s
retries: 5
restart: unless-stopped
redis:
image: redis:6-alpine
volumes:
- redis_data:/data
command: redis-server --appendonly yes
restart: unless-stopped
web:
build:
context: .
dockerfile: Dockerfile
command: >
sh -c "python manage.py migrate &&
python manage.py collectstatic --noinput &&
gunicorn simple_imap2api.wsgi:application --bind 0.0.0.0:8000 --workers 3 --timeout 300"
volumes:
- static_volume:/app/staticfiles
- media_volume:/app/media
- ./logs:/app/logs
environment:
- DJANGO_SETTINGS_MODULE=simple_imap2api.settings
- DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}
- DJANGO_DEBUG=False
- ALLOWED_HOSTS=${ALLOWED_HOSTS}
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_HOST=db
- DB_PORT=5432
- REDIS_URL=redis://redis:6379/0
depends_on:
db:
condition: service_healthy
redis:
condition: service_started
restart: unless-stopped
celery:
build:
context: .
dockerfile: Dockerfile
command: celery -A simple_imap2api worker -l INFO
volumes:
- ./logs:/app/logs
environment:
- DJANGO_SETTINGS_MODULE=simple_imap2api.settings
- DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}
- DJANGO_DEBUG=False
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_HOST=db
- DB_PORT=5432
- REDIS_URL=redis://redis:6379/0
depends_on:
- web
- redis
restart: unless-stopped
celery-beat:
build:
context: .
dockerfile: Dockerfile
command: celery -A simple_imap2api beat -l INFO
volumes:
- ./logs:/app/logs
environment:
- DJANGO_SETTINGS_MODULE=simple_imap2api.settings
- DJANGO_SECRET_KEY=${DJANGO_SECRET_KEY}
- DJANGO_DEBUG=False
- DB_NAME=${DB_NAME}
- DB_USER=${DB_USER}
- DB_PASSWORD=${DB_PASSWORD}
- DB_HOST=db
- DB_PORT=5432
- REDIS_URL=redis://redis:6379/0
depends_on:
- web
- redis
restart: unless-stopped
nginx:
image: nginx:1.21-alpine
volumes:
- static_volume:/app/staticfiles
- media_volume:/app/media
- ./nginx.conf:/etc/nginx/conf.d/default.conf
- ./logs/nginx:/var/log/nginx
ports:
- "${PORT:-80}:80"
depends_on:
- web
restart: unless-stopped
volumes:
postgres_data:
redis_data:
static_volume:
media_volume: