diff --git a/README.md b/README.md index 667d007..74fdbd5 100644 --- a/README.md +++ b/README.md @@ -63,6 +63,9 @@ containers: mem_limit: 512m volumes: - "{{ appdata_path }}/unifi:{{ container_config_path }}" + depends_on: + - service: mongodb + condition: service_started include_global_env_vars: true restart: "{{ unless_stopped }}" - service_name: quassel @@ -75,4 +78,4 @@ containers: mem_limit: 128m ports: - "4242:4242" -``` \ No newline at end of file +``` diff --git a/templates/docker-compose.yml.j2 b/templates/docker-compose.yml.j2 index 9da932c..dd816af 100644 --- a/templates/docker-compose.yml.j2 +++ b/templates/docker-compose.yml.j2 @@ -80,7 +80,12 @@ services: {% if container.depends_on is defined %} depends_on: {% for dependent in container.depends_on %} +{% if dependent is mapping %} + {{ dependent.service}}: + condition: {{ dependent.condition }} +{% else %} - {{ dependent }} +{% endif %} {% endfor %} {% endif %} {% if container.hostname is defined %} @@ -160,8 +165,19 @@ services: - {{ envfile }} {% endfor %} {% endif %} -{% if container.user is defined %} - user: {{ container.user }} +{% if container.healthcheck is defined %} + healthcheck: + test: "{{ container.healthcheck.test }}" +{% if container.healthcheck.interval is defined %} + interval: {{ container.healthcheck.interval }} +{% endif %} +{% if container.healthcheck.timeout is defined %} + timeout: {{ container.healthcheck.timeout }} +{% endif %} +{% if container.healthcheck.retries is defined %} + retries: {{ container.healthcheck.retries }} +{% endif %} + start_period: {{ container.healthcheck.start_period }} {% endif %} {% if container.restart is defined %} restart: {{ container.restart }}