fix(healthcheck): use dynamic PORT, IPv4 127.0.0.1, and bind 0.0.0.0

This commit is contained in:
2026-08-25 02:56:42 +03:30
parent 38e048067b
commit b708a6b777
2 changed files with 6 additions and 6 deletions
+4 -4
View File
@@ -19,7 +19,7 @@ FROM node:22-alpine AS production
WORKDIR /app
ENV NODE_ENV=production \
PORT=3000
PORT=5000
# Copy installed production dependencies and application code with proper ownership
COPY --chown=node:node --from=dependencies /app/node_modules ./node_modules
@@ -28,10 +28,10 @@ COPY --chown=node:node . .
# Run as non-root user
USER node
EXPOSE 3000
EXPOSE 5000
# Healthcheck targeting the API health endpoint
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT:-5000}/api/health || exit 1
CMD ["node", "app.js"]