diff --git a/Dockerfile b/Dockerfile index 96bb2ff..ed55dc5 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 diff --git a/index.js b/index.js index 0e7506e..2e55ad5 100644 --- a/index.js +++ b/index.js @@ -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' }); }); \ No newline at end of file