From ab0c2671aeda81483e5824598341b1ba78941bf3 Mon Sep 17 00:00:00 2001 From: Kavehhn174 Date: Thu, 13 Aug 2026 11:32:44 +0330 Subject: [PATCH] feat: add /healthz and /health endpoint for Coolify health check --- Dockerfile | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index f8dd639..368dcb3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -26,7 +26,7 @@ RUN npm run build # ------------------------------------------------------------------------------ FROM nginx:1.27-alpine AS production -# Inline Nginx configuration for SPA routing, gzip, and caching +# Inline Nginx configuration for SPA routing, gzip, caching, and healthcheck RUN printf 'server {\n\ listen 80;\n\ server_name localhost;\n\ @@ -34,6 +34,11 @@ RUN printf 'server {\n\ index index.html;\n\ gzip on;\n\ gzip_types text/plain text/css text/javascript application/javascript application/json image/svg+xml;\n\ + location ~ ^/(healthz|health)$ {\n\ + access_log off;\n\ + default_type text/plain;\n\ + return 200 "OK";\n\ + }\n\ location / {\n\ try_files $uri $uri/ /index.html;\n\ }\n\ @@ -49,8 +54,8 @@ COPY --from=build /app/dist /usr/share/nginx/html EXPOSE 80 -# Health check to ensure Nginx is responding on port 80 +# Health check endpoint for Docker & Coolify targeting /healthz HEALTHCHECK --interval=30s --timeout=5s --start-period=5s --retries=3 \ - CMD wget --no-verbose --tries=1 --spider http://localhost:80/ || exit 1 + CMD wget --no-verbose --tries=1 --spider http://localhost:80/healthz || exit 1 CMD ["nginx", "-g", "daemon off;"]