deploy: fix healthcheck — hit 127.0.0.1 not localhost

wget inside the alpine container resolves `localhost` to ::1, but nginx
only binds IPv4 with `listen 80;`, so the healthcheck saw 'Connection
refused' even though the container was happily serving traffic to Caddy.
Pinning the check to 127.0.0.1 keeps it strictly IPv4.
This commit is contained in:
Jose Luis Montañes
2026-05-01 19:08:28 +02:00
parent d3786c9768
commit 847a6c6881

View File

@@ -10,5 +10,6 @@ COPY nginx.conf /etc/nginx/conf.d/default.conf
COPY web/ /usr/share/nginx/html/ COPY web/ /usr/share/nginx/html/
EXPOSE 80 EXPOSE 80
# 127.0.0.1 on purpose: nginx binds IPv4 only and `localhost` may resolve to ::1
HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
CMD wget -qO- http://localhost/ >/dev/null || exit 1 CMD wget -qO- http://127.0.0.1/ >/dev/null || exit 1