Repository navigation
Expand file tree
/
Copy pathdocker-compose.prod.yml
More file actions
58 lines (55 loc) · 1.98 KB
/
Copy pathdocker-compose.prod.yml
File metadata and controls
58 lines (55 loc) · 1.98 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
name: moscowpythonpro-production
x-app: &app
image: ${APP_IMAGE:?Set APP_IMAGE to the full GHCR image reference}
environment:
SECRET_KEY: ${SECRET_KEY:?Supply SECRET_KEY via the production GitHub secret and .env.secrets}
DEBUG: "False"
ALLOWED_HOSTS: ${ALLOWED_HOSTS:?Set ALLOWED_HOSTS including the public domain and 127.0.0.1}
CSRF_TRUSTED_ORIGINS: ${CSRF_TRUSTED_ORIGINS:?Set CSRF_TRUSTED_ORIGINS to the public HTTPS origin}
SITE_URL: ${SITE_URL:?Set SITE_URL to the public HTTPS origin}
SITE_URL_FROM_REQUEST: "False"
TRUST_PROXY_SSL_HEADER: "True"
DATABASE_URL: postgresql://${POSTGRES_USER:-moscowpythonpro}:${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD to a generated hex password}@db:5432/${POSTGRES_DB:-moscowpythonpro}
services:
db:
image: postgres:17-alpine@sha256:b0f9560a2de083e2cc7382e75f808c7381a32852a7ec49117deedb300e552b24
environment:
POSTGRES_DB: ${POSTGRES_DB:-moscowpythonpro}
POSTGRES_USER: ${POSTGRES_USER:-moscowpythonpro}
POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:?Set POSTGRES_PASSWORD to a generated hex password}
volumes:
- postgres_data:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 5s
timeout: 5s
retries: 10
restart: unless-stopped
migrate:
<<: *app
profiles: ["tools"]
command: ["python", "manage.py", "migrate", "--noinput"]
healthcheck:
disable: true
depends_on:
db:
condition: service_healthy
web:
<<: *app
volumes:
- resident_photos:/app/media
ports:
- "127.0.0.1:${APP_PORT:-8000}:8000"
healthcheck:
test: ["CMD", "python", "-c", "import urllib.request; urllib.request.urlopen('http://127.0.0.1:8000/health', timeout=3)"]
interval: 30s
timeout: 5s
start_period: 20s
retries: 3
depends_on:
db:
condition: service_healthy
restart: unless-stopped
volumes:
postgres_data:
resident_photos: