From b708a6b77745a98793f168eb8bf10ba1e21dffac Mon Sep 17 00:00:00 2001 From: Kavehhn174 Date: Tue, 25 Aug 2026 02:56:42 +0330 Subject: [PATCH] fix(healthcheck): use dynamic PORT, IPv4 127.0.0.1, and bind 0.0.0.0 --- Dockerfile | 8 ++++---- app.js | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 60e7b9e..60a5d5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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"] diff --git a/app.js b/app.js index 73da8ea..36e9dcc 100644 --- a/app.js +++ b/app.js @@ -142,8 +142,8 @@ const startServer = async () => { startTempBucketCleanupJob(); startClassReminderJob(); - app.listen(PORT, () => { - logger.info(`Gameno API listening on http://localhost:${PORT} [${config.NODE_ENV}]`); + app.listen(PORT, '0.0.0.0', () => { + logger.info(`Gameno API listening on http://0.0.0.0:${PORT} [${config.NODE_ENV}]`); }); };