Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml.j2
More file actions
68 lines (54 loc) · 1.99 KB
/
Copy pathdocker-compose.yml.j2
File metadata and controls
68 lines (54 loc) · 1.99 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
# this is a Jinja2 template file used during the Ansible deployment
# environment specific configuration can be found in our Ansble scripts
---
name: {{ compose_stack_name }}
services:
{{ caddy_svc | indent(width=2, first=True ) }}
{% set service = (stack.services | selectattr('name', 'eq', 'app') | first) %}
app:
image: ghcr.io/{{ template.git.package.image_name }}:{{ template.git.package.tag }}
restart: unless-stopped
{{ service | get_deploy_resources_by_service | indent(width=2) }}
{% if service.environment is defined %}
environment:
{% for env in service.environment %}
- {{ env.key }}={{ env.value }}
{% endfor %}
{% endif %}
command: >
sh -c "uv run --no-sync python manage.py migrate &&
uv run --no-sync python manage.py runserver 0.0.0.0:8000"
{% if service.volumes | default([]) | length > 0 %}
volumes:
{% for vol in service.volumes %}
- {{ vol.host_path if vol.host_path is defined else vol.name }}:{{ vol.container_path }}
{% endfor %}
{% endif %}
depends_on:
db:
condition: service_healthy
{% set service = (stack.services | selectattr('name', 'eq', 'db') | first) %}
db:
image: {{ service.image if service.image is defined else "postgres:latest" }}
restart: unless-stopped
{% if service.environment is defined %}
environment:
{% for env in service.environment %}
- {{ env.key }}={{ env.value }}
{% endfor %}
{% endif %}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U {{ (service.environment | selectattr('key', 'eq', 'POSTGRES_USER')
| first).value }}"]
interval: 5s
timeout: 5s
retries: 5
{% if service.volumes | default([]) | length > 0 %}
volumes:
{% for vol in service.volumes %}
- {{ vol.host_path if vol.host_path is defined else vol.name }}:{{ vol.container_path }}
{% endfor %}
{% endif %}
volumes:
{{ caddy_vols | indent(width=2, first=True ) }}
{{ stack | get_all_named_volumes(compose_stack_name) | indent(width=2) }}