fix(healthcheck): use dynamic PORT, IPv4 127.0.0.1, and bind 0.0.0.0
This commit is contained in:
+4
-4
@@ -19,7 +19,7 @@ FROM node:22-alpine AS production
|
|||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
|
|
||||||
ENV NODE_ENV=production \
|
ENV NODE_ENV=production \
|
||||||
PORT=3000
|
PORT=5000
|
||||||
|
|
||||||
# Copy installed production dependencies and application code with proper ownership
|
# Copy installed production dependencies and application code with proper ownership
|
||||||
COPY --chown=node:node --from=dependencies /app/node_modules ./node_modules
|
COPY --chown=node:node --from=dependencies /app/node_modules ./node_modules
|
||||||
@@ -28,10 +28,10 @@ COPY --chown=node:node . .
|
|||||||
# Run as non-root user
|
# Run as non-root user
|
||||||
USER node
|
USER node
|
||||||
|
|
||||||
EXPOSE 3000
|
EXPOSE 5000
|
||||||
|
|
||||||
# Healthcheck targeting the API health endpoint
|
# Healthcheck targeting the API health endpoint
|
||||||
HEALTHCHECK --interval=30s --timeout=5s --start-period=15s --retries=3 \
|
HEALTHCHECK --interval=15s --timeout=5s --start-period=10s --retries=3 \
|
||||||
CMD wget --no-verbose --tries=1 --spider http://localhost:3000/api/health || exit 1
|
CMD wget --no-verbose --tries=1 --spider http://127.0.0.1:${PORT:-5000}/api/health || exit 1
|
||||||
|
|
||||||
CMD ["node", "app.js"]
|
CMD ["node", "app.js"]
|
||||||
|
|||||||
@@ -142,8 +142,8 @@ const startServer = async () => {
|
|||||||
startTempBucketCleanupJob();
|
startTempBucketCleanupJob();
|
||||||
startClassReminderJob();
|
startClassReminderJob();
|
||||||
|
|
||||||
app.listen(PORT, () => {
|
app.listen(PORT, '0.0.0.0', () => {
|
||||||
logger.info(`Gameno API listening on http://localhost:${PORT} [${config.NODE_ENV}]`);
|
logger.info(`Gameno API listening on http://0.0.0.0:${PORT} [${config.NODE_ENV}]`);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user