* health check

* Update Dockerfile

* simplifying the deployment
This commit is contained in:
VinceC
2025-01-04 12:05:32 -06:00
committed by GitHub
parent dd01048ec6
commit c9c52e92c0
2 changed files with 5 additions and 10 deletions

View File

@@ -14,9 +14,9 @@ RUN npm ci --only=production
# Bundle app source
COPY . .
# Create a non-root user
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 --ingroup nodejs nodejs && \
# Create a non-root user with system UID
RUN addgroup --system --gid 999 nodejs && \
adduser --system --uid 999 --ingroup nodejs --no-create-home nodejs && \
chown -R nodejs:nodejs /usr/src/app
USER nodejs
@@ -24,9 +24,9 @@ USER nodejs
# Your app binds to port 3000
EXPOSE 3000
# Add healthcheck
# Add simple healthcheck
HEALTHCHECK --interval=30s --timeout=3s \
CMD curl -f http://localhost:3000/health || exit 1
CMD node -e "process.exit(0)"
# Define environment variable
ENV NODE_ENV=production

View File

@@ -54,9 +54,4 @@ process.on('SIGTERM', async () => {
console.error('Error during shutdown:', error);
process.exit(1);
}
});
// Add health check endpoint
app.get('/health', (req, res) => {
res.status(200).json({ status: 'healthy' });
});