From 0199814d304ee0ae57d515ca073f271de8041c0e Mon Sep 17 00:00:00 2001 From: qtrinh2 Date: Thu, 12 Sep 2024 16:49:20 -0400 Subject: [PATCH] debug --- django/docker-compose.yml.j2 | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/django/docker-compose.yml.j2 b/django/docker-compose.yml.j2 index 9a50812..ed0bd63 100644 --- a/django/docker-compose.yml.j2 +++ b/django/docker-compose.yml.j2 @@ -28,14 +28,16 @@ services: command: > sh -c "poetry run python manage.py migrate && poetry run python manage.py runserver 0.0.0.0:8000" - {% if template.volumes is defined and ((template.volumes | selectattr('service', 'eq', service)) is iterable) %} - + {% if template.volumes is defined %} + {% set vols = (template.volumes | selectattr('service', 'eq', service) %} + {% if vols is iterable and vols | length > 0 %} volumes: - {% for vol in (template.volumes | selectattr('service', 'eq', service)) %} + {% for vol in vols %} - {{ vol.name }}:{{ vol.container_path }} {% endfor %} {% endif %} + {% endif %} depends_on: db: @@ -51,14 +53,16 @@ services: - POSTGRES_USER={{ template.env.db_user }} - POSTGRES_PASSWORD={{ template.env.db_pass }} - POSTGRES_HOST=db - {% if template.volumes is defined and ((template.volumes | selectattr('service', 'eq', service)) is iterable) %} - + {% if template.volumes is defined %} + {% set vols = (template.volumes | selectattr('service', 'eq', service) %} + {% if vols is iterable and vols | length > 0 %} volumes: - {% for vol in (template.volumes | selectattr('service', 'eq', service)) %} + {% for vol in vols %} - {{ vol.name }}:{{ vol.container_path }} {% endfor %} {% endif %} + {% endif %} healthcheck: test: ["CMD-SHELL", "pg_isready -U {{ template.env.db_user }} -d {{ template.env.db_name }}"]