From c4086f9e23a7b29b5322326d7c32fc9dbb309f4b Mon Sep 17 00:00:00 2001 From: Slim Uiltjies App Date: Sat, 8 Aug 2026 09:31:01 +0200 Subject: [PATCH] Fix Dockerfile healthcheck - Add curl explicitly (wget in Alpine has IPv6/connection quirks) - Use 127.0.0.1 instead of localhost to avoid IPv6 races - Extend start-period to 60s (Node cold-start can take 30-60s) - More retries (8 instead of 3) for resilience during first deploy --- Dockerfile | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6ae0a91..6f37b60 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,8 @@ FROM node:20-alpine +# Install curl explicitly for the healthcheck (wget in alpine has had IPv6/connection-resolved quirks) +RUN apk add --no-cache curl + # Create app directory and data directory for the persistent volume WORKDIR /app RUN mkdir -p /data @@ -19,8 +22,10 @@ ENV PORT=3000 \ EXPOSE 3000 # Healthcheck for Coolify / orchestrators -HEALTHCHECK --interval=30s --timeout=3s --start-period=10s --retries=3 \ - CMD wget -q --spider http://localhost:3000/api/health || exit 1 +# Use 127.0.0.1 (IPv4 explicit) to avoid IPv6 connection-refused races. +# Generous start-period because Node + Alpine cold-start can take ~30-60s on first deploy. +HEALTHCHECK --interval=20s --timeout=5s --start-period=60s --retries=8 \ + CMD curl -fsS http://127.0.0.1:3000/api/health || exit 1 # Run as non-root for safety RUN addgroup -S app && adduser -S app -G app && chown -R app:app /app /data