-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
78 lines (73 loc) · 1.79 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
78 lines (73 loc) · 1.79 KB
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
version: '3.8'
services:
# PostgreSQL Database
db:
image: postgres:15-alpine
container_name: mindspace_db_prod
restart: unless-stopped
env_file:
- .env.prod
environment:
POSTGRES_DB: ${DB_NAME}
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
volumes:
- postgres_data_prod:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ${DB_USER}"]
interval: 30s
timeout: 10s
retries: 3
networks:
- mindspace_network_prod
# Django Backend (Production)
backend:
build: ./backend
container_name: mindspace_backend_prod
restart: unless-stopped
command: >
sh -c "
python manage.py migrate &&
python manage.py collectstatic --noinput &&
gunicorn backend.wsgi:application --bind 0.0.0.0:8000 --workers 3
"
env_file:
- .env.prod
environment:
DB_HOST: db
DB_PORT: 5432
DEBUG: False
volumes:
- static_volume_prod:/app/staticfiles
- media_volume_prod:/app/media
depends_on:
db:
condition: service_healthy
networks:
- mindspace_network_prod
# Nginx (Production)
nginx:
build:
context: ./mindspace-frontend
dockerfile: Dockerfile # Uses production Dockerfile
container_name: mindspace_nginx_prod
restart: unless-stopped
ports:
- "80:80"
- "443:443"
volumes:
- ./nginx/prod/nginx.conf:/etc/nginx/conf.d/default.conf
- ./nginx/ssl:/etc/nginx/ssl
- static_volume_prod:/app/staticfiles
- media_volume_prod:/app/media
depends_on:
- backend
networks:
- mindspace_network_prod
networks:
mindspace_network_prod:
driver: bridge
volumes:
postgres_data_prod:
static_volume_prod:
media_volume_prod: