-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.prod.nginx-proxy.yml
117 lines (111 loc) · 3.36 KB
/
docker-compose.prod.nginx-proxy.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
services:
django:
build:
context: .
dockerfile: docker/django/Dockerfile.django.prod
container_name: ${DJANGO_CONTAINER_NAME?}
restart: unless-stopped
env_file: prod.env
environment:
- DJANGO_SECURE_SSL_REDIRECT=True
- DJANGO_SECURE_PROXY_SSL_HEADER_CHECK=True
- VIRTUAL_HOST=${DJANGO_ALLOWED_HOSTS?}
- VIRTUAL_PORT=8000
- LETSENCRYPT_HOST=${DJANGO_ALLOWED_HOSTS?}
command: sh -c "
./wait-for-it.sh db:5432 -t 0 &&
python manage.py migrate --noinput &&
./rebuild.sh &&
python manage.py collectstatic --noinput &&
gunicorn config.wsgi:application --bind 0.0.0.0:8000
"
volumes:
- .:/usr/src/app
- static_volume:/usr/src/app/staticfiles
- media_volume:/usr/src/app/media
- logs_volume:/usr/src/app/logs
networks:
web:
aliases:
- web
expose:
- "8000"
depends_on:
- db
- redis
db:
image: postgis/postgis:16-3.4
container_name: ${DB_CONTAINER_NAME?}
restart: unless-stopped
hostname: db
environment:
- POSTGRES_DB=${DB_NAME?}
- POSTGRES_USER=${DB_USERNAME?}
- POSTGRES_PASSWORD=${DB_PASSWORD?}
volumes:
- postgres_data:/var/lib/postgresql/data
networks:
- web
ports:
- "5432:5432"
nginx-proxy:
build:
context: docker/nginx
dockerfile: Dockerfile.nginx-proxy
container_name: ${NGINX_PROXY_CONTAINER_NAME?}
restart: unless-stopped
volumes:
- static_volume:/usr/src/app/staticfiles
- media_volume:/usr/src/app/media
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- certs:/etc/nginx/certs:ro
- html:/usr/share/nginx/html
- /var/run/docker.sock:/tmp/docker.sock:ro
networks:
- web
ports:
- "443:443"
- "80:80"
depends_on:
- django
nginx-proxy-acme-companion:
image: nginxproxy/acme-companion:2.5.2
container_name: ${NGINX_PROXY_ACME_COMPANION_CONTAINER_NAME?}
restart: unless-stopped
env_file: prod.env
environment:
- NGINX_PROXY_CONTAINER=${NGINX_PROXY_CONTAINER_NAME?}
- DEFAULT_EMAIL=${ADMIN_EMAIL?}
volumes:
- conf:/etc/nginx/conf.d
- vhost:/etc/nginx/vhost.d
- certs:/etc/nginx/certs:rw
- html:/usr/share/nginx/html
- acme:/etc/acme.sh
- /var/run/docker.sock:/var/run/docker.sock:ro
depends_on:
- nginx-proxy
redis:
image: redis:7.4.2-alpine
container_name: ${REDIS_CONTAINER_NAME?}
restart: unless-stopped
volumes:
- redis_data:/data
networks:
- web
expose:
- "6379"
networks:
web:
volumes:
static_volume:
media_volume:
logs_volume:
postgres_data:
conf:
vhost:
certs:
html:
acme:
redis_data: