feat: add /healthz and /health endpoint for Coolify health check
This commit is contained in:
+8
-3
@@ -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;"]
|
||||
|
||||
Reference in New Issue
Block a user