-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
162 lines (153 loc) · 4.44 KB
/
Copy pathdocker-compose.yml
File metadata and controls
162 lines (153 loc) · 4.44 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
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
name: tcf
services:
db:
# Postgres 18.1 to match prod RDS.
image: postgres:18.1
container_name: tcf_db
restart: unless-stopped
environment:
POSTGRES_USER: ${DB_USER}
POSTGRES_PASSWORD: ${DB_PASSWORD}
POSTGRES_DB: ${DB_NAME}
PGUSER: ${DB_USER} # client tool defaults so psql/pg_* need no -U/-d
PGDATABASE: ${DB_NAME}
volumes:
# postgres:18 images mount at /var/lib/postgresql, not /data,
# so pg_upgrade can see multiple version directories.
- pgdata:/var/lib/postgresql
healthcheck:
test: ["CMD-SHELL", "pg_isready -U $$POSTGRES_USER -d $$POSTGRES_DB"]
interval: 2s
timeout: 2s
retries: 30
valkey:
# ElastiCache in prod runs Valkey 8.2; no such image on Docker Hub yet.
image: valkey/valkey:8.1
container_name: tcf_valkey
restart: unless-stopped
healthcheck:
test: ["CMD", "valkey-cli", "ping"]
interval: 2s
timeout: 2s
retries: 30
minio:
image: quay.io/minio/minio:latest
container_name: tcf-minio
command: server /data --console-address ":9001"
restart: unless-stopped
environment:
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:-minioadmin}
ports:
- "127.0.0.1:9000:9000"
- "127.0.0.1:9001:9001" # console UI
volumes:
- minio_data:/data
healthcheck:
test: ["CMD", "curl", "-sf", "http://localhost:9000/minio/health/live"]
interval: 2s
timeout: 2s
retries: 30
# Creates buckets and grants anonymous read on the static bucket
# (stands in for CloudFront's signed origin access).
minio-init:
image: quay.io/minio/mc:latest
container_name: tcf-minio_init
depends_on:
minio:
condition: service_healthy
environment:
MINIO_ROOT_USER: ${MINIO_ACCESS_KEY:-minioadmin}
MINIO_ROOT_PASSWORD: ${MINIO_SECRET_KEY:-minioadmin}
entrypoint: >
sh -c '
mc alias set local http://minio:9000 $$MINIO_ROOT_USER $$MINIO_ROOT_PASSWORD &&
mc mb --ignore-existing local/${MINIO_BUCKET:-tcf-media} local/${STATIC_BUCKET:-tcf-static} &&
mc anonymous set download local/${STATIC_BUCKET:-tcf-static} &&
echo "buckets ready"'
restart: "no"
# Serves the static bucket on :8081.
cdn:
build:
context: .
dockerfile: Dockerfile.cdn
image: tcf-cdn:local
container_name: tcf-cdn
restart: unless-stopped
environment:
STATIC_BUCKET: ${STATIC_BUCKET:-tcf-static}
ports:
- "8081:80"
depends_on:
minio:
condition: service_healthy
# One-off job mirroring the ECS release task.
release:
profiles: ["full"]
build:
context: .
target: prod
container_name: tcf_release
env_file: .env
command: >
bash -c "set -e &&
python manage.py migrate &&
python manage.py collectstatic --noinput &&
python manage.py invalidate_cachalot tcf_website &&
python manage.py clearsessions"
environment:
DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE:-tcf_core.settings.dev}
TCF_ENV: ${TCF_ENV:-local}
restart: "no"
depends_on:
db:
condition: service_healthy
valkey:
condition: service_healthy
minio-init:
condition: service_completed_successfully
web:
profiles: ["full"]
build:
context: .
target: prod
container_name: tcf_web
env_file: .env
environment:
DJANGO_SETTINGS_MODULE: ${DJANGO_SETTINGS_MODULE:-tcf_core.settings.dev}
TCF_ENV: ${TCF_ENV:-local}
ports:
- "8000:80"
restart: unless-stopped
depends_on:
db:
condition: service_healthy
valkey:
condition: service_healthy
release:
condition: service_completed_successfully
devcontainer:
profiles: ["dev"]
build:
context: .
target: dev
container_name: tcf_devcontainer
command: sleep infinity
environment:
DJANGO_SETTINGS_MODULE: tcf_core.settings.dev
TCF_ENV: local
volumes:
# Mount the checkout so the devcontainer contains the full source tree.
- .:/app:cached
# Docker-outside-of-docker: control sibling services via the host daemon.
- /var/run/docker.sock:/var/run/docker.sock
depends_on:
db:
condition: service_healthy
valkey:
condition: service_healthy
minio-init:
condition: service_completed_successfully
volumes:
pgdata:
minio_data: