Repository navigation
Expand file tree
/
Copy pathdocker-compose.prod.yaml
More file actions
79 lines (74 loc) · 2.6 KB
/
Copy pathdocker-compose.prod.yaml
File metadata and controls
79 lines (74 loc) · 2.6 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
79
name: ntx_prod_local
x-web-env: &web-env
DJANGO_DEBUG: "False"
DJANGO_SECRET_KEY: "local-prod-test-insecure-key-change-in-production"
DJANGO_SETTINGS_MODULE: "ntxconfig.settings.production"
DATABASE_URL: "postgres://ntx_user:ntx_local_password@db:5432/ntx_dev"
ALLOWED_HOSTS: "localhost,127.0.0.1,0.0.0.0"
CSRF_TRUSTED_ORIGINS: "http://localhost:8000"
# This local production-image test is served directly over HTTP.
DJANGO_SECURE_COOKIES: "False"
# Local defaults; override from .env when needed.
DJANGO_SUPERUSER_USERNAME: "${DJANGO_SUPERUSER_USERNAME:-admin}"
DJANGO_SUPERUSER_PASSWORD: "${DJANGO_SUPERUSER_PASSWORD:-admin}"
DJANGO_SUPERUSER_EMAIL: "${DJANGO_SUPERUSER_EMAIL:-}" # Optional
# Placeholder SMTP settings allow startup; configure real values to test delivery.
EMAIL_HOST: "${EMAIL_HOST:-smtp.invalid}"
EMAIL_PORT: "${EMAIL_PORT:-587}"
EMAIL_USE_TLS: "${EMAIL_USE_TLS:-True}"
EMAIL_HOST_USER: "${EMAIL_HOST_USER:-local-prod-unused}"
EMAIL_HOST_PASSWORD: "${EMAIL_HOST_PASSWORD:-local-prod-unused}"
DEFAULT_FROM_EMAIL: "${DEFAULT_FROM_EMAIL:-noreply@example.invalid}"
services:
db:
image: docker.io/library/postgres:18
environment:
POSTGRES_DB: ntx_dev
POSTGRES_USER: ntx_user
POSTGRES_PASSWORD: ntx_local_password
ports:
- "127.0.0.1:5432:5432"
volumes:
- pgdata:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U ntx_user -d ntx_dev"]
interval: 5s
timeout: 3s
retries: 10
# The production image currently runs migrations in its CMD before starting
# Gunicorn, so this separate migration service is disabled for now.
# To be re-enabled when migrations are handled by ArgoCD/Kubernetes.
# migrate:
# build:
# context: .
# dockerfile: Containerfile
# target: prod
# command: ["python", "manage.py", "migrate", "--noinput"]
# volumes:
# - media:/app/media
# environment: *web-env
# depends_on:
# db:
# condition: service_healthy
web:
# alternatively image: ghcr.io/utrechtuniversity/ntx:develop
build:
context: .
dockerfile: Containerfile
target: cloud
user: 1001:0 # check non root user (not 0=root or 1000=app)
ports:
- "8000:8000"
volumes:
- media:/app/media
environment: *web-env
depends_on:
db:
condition: service_healthy
# Re-enable this dependency together with the separate migrate service
# above when ArgoCD/Kubernetes handles migrations outside the web CMD.
# migrate:
# condition: service_completed_successfully
volumes:
pgdata:
media: