Spaces:
Running
Running
| ```dockerfile | |
| FROM node:18-alpine | |
| WORKDIR /app | |
| # Copy package files | |
| COPY package*.json ./ | |
| # Install dependencies | |
| RUN npm install --only=production | |
| # Copy source code | |
| COPY . . | |
| # Create non-root user | |
| RUN addgroup -g 1001 -S nodejs | |
| RUN adduser -S deepsite -u 1001 | |
| # Change ownership of the app directory | |
| RUN chown -R deepsite:nodejs /app | |
| USER deepsite | |
| EXPOSE 5000 | |
| # Health check | |
| HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ | |
| CMD node -e "require('http').get('http://localhost:5000/api/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })" | |
| CMD ["npm", "start"] | |
| ``` |