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

View File

@@ -55,8 +55,3 @@ process.on('SIGTERM', async () => {
process.exit(1); process.exit(1);
} }
}); });
// Add health check endpoint
app.get('/health', (req, res) => {
res.status(200).json({ status: 'healthy' });
});