feat(docker): Added healthcheck
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
@@ -21,6 +21,27 @@ services:
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if service.ports is defined and service.ports is iterable %}
|
||||
{% set first_http_port = service.ports | default([]) | selectattr('name', 'defined') | selectattr('name', 'search', 'http') | first %}
|
||||
{% set chosen_http_port_value = none %}
|
||||
{% if first_http_port is not none %}
|
||||
{% if first_http_port.internal is defined and first_http_port.internal == 'proxy_only' %}
|
||||
{% if first_http_port.external is defined %}
|
||||
{% set chosen_http_port_value = first_http_port.external %}
|
||||
{% endif %}
|
||||
{% else %}
|
||||
{% set chosen_http_port_value = first_http_port.internal %}
|
||||
{% endif %}
|
||||
{% if chosen_http_port_value is defined %}
|
||||
healthcheck:
|
||||
test: ["CMD-SHELL", "wget --quiet --spider --timeout=5 http://localhost:{{ chosen_http_port_value }}/ || exit 1"]
|
||||
interval: 30s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 20s
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
{% if service.cap_add is defined and service.cap_add is iterable %}
|
||||
cap_add:
|
||||
{% for cap in service.cap_add %}
|
||||
|
||||
Reference in New Issue
Block a user