Skip to content

Commit

Permalink
volumes stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
qtrinh2 committed Sep 12, 2024
1 parent f8743e4 commit 5430a62
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions django/docker-compose.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ services:
command: >
sh -c "poetry run python manage.py migrate &&
poetry run python manage.py runserver 0.0.0.0:8000"
volumes:
{% for vol in (template.volumes | selectattr('service', 'eq', 'app') %}
- {{ vol.name }}:{{ vol.container_path }}
{% endfor %}
depends_on:
db:
condition: service_healthy
Expand All @@ -36,7 +40,9 @@ services:
- POSTGRES_PASSWORD={{ template.env.db_pass }}
- POSTGRES_HOST=db
volumes:
- {{ template.volumes | selectattr('container_path', 'eq', '/var/lib/postgresql/data/') | first }}:/var/lib/postgresql/data/
{% for vol in (template.volumes | selectattr('service', 'eq', 'db') %}
- {{ vol.name }}:{{ vol.container_path }}
{% endfor %}
healthcheck:
test: ["CMD-SHELL", "pg_isready -U {{ template.env.db_user }} -d {{ template.env.db_name }}"]
interval: 2s
Expand All @@ -47,6 +53,6 @@ volumes:
{% for vol in template.volumes %}

{{ vol.name }}:
name: "{{ compose_stack_name }}--{{ vol.id }}"
name: "{{ compose_stack_name }}--{{ vol.name }}"
external: true
{% endfor %}

0 comments on commit 5430a62

Please sign in to comment.