From 6fb2f837168a8656c33b3396254f02403b56a400 Mon Sep 17 00:00:00 2001 From: Nicolas Varrot Date: Fri, 13 Feb 2026 11:12:43 +0000 Subject: [PATCH] fix: add Docker HEALTHCHECK for container health monitoring - Add HEALTHCHECK instruction to Dockerfile (wget localhost:80, 30s interval) - Add healthcheck config to docker-compose.yml - Enables Docker/orchestrator health monitoring and auto-restart on failure --- Dockerfile | 2 ++ docker-compose.yml | 6 ++++++ 2 files changed, 8 insertions(+) diff --git a/Dockerfile b/Dockerfile index b5112c5..f0d9405 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,4 +11,6 @@ FROM nginx:alpine COPY --from=build /app/dist /usr/share/nginx/html COPY nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 +HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ + CMD wget -qO /dev/null http://localhost:80/ || exit 1 CMD ["nginx", "-g", "daemon off;"] diff --git a/docker-compose.yml b/docker-compose.yml index d7f1deb..2c0e923 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -6,3 +6,9 @@ services: ports: - "3000:80" restart: unless-stopped + healthcheck: + test: ["CMD", "wget", "-qO", "/dev/null", "http://localhost:80/"] + interval: 30s + timeout: 3s + start_period: 5s + retries: 3