-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose-prod_template.yml
54 lines (53 loc) · 1.74 KB
/
docker-compose-prod_template.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
# Docker compose template for use in production
# Generate a new SECRET_KEY and replace setting below prior to deployment
services:
web:
container_name: learning_log-web
deploy:
resources:
limits:
cpus: "${DOCKER_WEB_CPUS:-0}"
memory: "${DOCKER_WEB_MEMORY:-0}"
build: .
# command: python /code/manage.py runserver 0.0.0.0:8000
command: gunicorn config.wsgi -b 0.0.0.0:8000
healthcheck:
test: "${DOCKER_WEB_HEALTHCHECK_TEST:-curl localhost:8000/healthcheck}"
interval: "60s"
timeout: "3s"
start_period: "5s"
retries: 3
volumes:
- .:/code
ports:
- "${DOCKER_WEB_PORT_FORWARD:-127.0.0.1:8000}:${PORT:-8000}"
depends_on:
- db
environment:
# SECRET_KEY needs to have at least 50 characters. With Base64 encoding,
# each byte has ~1.3 characters. The following will suffice to pass the
# Django deploy checklist.
# Note: if key includes a dollar sign, $, you will need to add an
# additional dollar sign, $$. This is due to how docker compose handles
# variable subsitution.
# python -c 'import secrets; print(secrets.token_urlsafe(38))'
- "SECRET_KEY=<insert_your_generated_key_here>"
env_file:
- ".env"
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
stop_grace_period: "3s"
profiles: ["web"]
db:
container_name: learning_log-db
environment:
POSTGRES_DB: "${POSTGRES_DB}"
POSTGRES_USER: "${POSTGRES_USER}"
POSTGRES_PASSWORD: "${POSTGRES_PASSWORD}"
image: postgres:15.6
profiles: ["postgres"]
restart: "${DOCKER_RESTART_POLICY:-unless-stopped}"
stop_grace_period: "3s"
volumes:
- postgres_data:/var/lib/postgresql/data/
volumes:
postgres_data: