-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker-compose.yml.j2
53 lines (51 loc) · 1.64 KB
/
docker-compose.yml.j2
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
# this is a Jinja2 template file used during the Ansible deployment
# environment specific configuration can be found in our Ansble scripts
services:
app:
image: ghcr.io/{{ template.git.package.image_name }}:{{ template.git.package.tag }}
container_name: {{ template.name }}_app
ports:
- "{{ template.env.host_app_port }}:8000"
environment:
- DEBUG={{ template.env.debug_flag }}
- DJANGO_SECRET_KEY={{ template.env.secret_key }}
- DJANGO_ALLOWED_HOSTS={{ template.env.allowed_hosts }}
- DJANGO_CSRF_TRUSTED_ORIGINS={{ template.env.trusted_origins }}
- DB_HOST=db
- DB_PORT={{ template.env.host_db_port }}
- DB_NAME={{ template.env.db_name }}
- DB_USER={{ template.env.db_user }}
- DB_PASSWORD={{ template.env.db_pass }}
volumes:
- dj-data:/app/media
depends_on:
db:
condition: service_healthy
command: >
sh -c "
poetry run python manage.py migrate &&
poetry run python manage.py runserver 0.0.0.0:8000
"
db:
image: postgres:16
container_name: {{ template.name }}_db
volumes:
- pg-data:/var/lib/postgresql/data/
environment:
- POSTGRES_DB={{ template.env.db_name }}
- POSTGRES_USER={{ template.env.db_user }}
- POSTGRES_PASSWORD={{ template.env.db_pass }}
- POSTGRES_HOST=db
healthcheck:
test: ["CMD-SHELL", "pg_isready -U lasfera"]
interval: 5s
timeout: 5s
retries: 5
# external volumes managed and defined by ansible
volumes:
dj-data:
name: "{{ template.name }}_app-vol"
external: true
pg-data:
name: "{{ template.name }}_db-vol"
external: true