# Use official Node.js runtime as base image FROM node:18-alpine # Set working directory in container WORKDIR /app # Copy package files COPY package*.json ./ # Install dependencies RUN npm ci --only=production # Copy application code COPY . . # Create necessary directories RUN mkdir -p logs tickets # Create non-root user for security RUN addgroup -g 1001 -S nodejs RUN adduser -S nodejs -u 1001 # Change ownership of app directory RUN chown -R nodejs:nodejs /app # Switch to non-root user USER nodejs # Expose port EXPOSE 3049 # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD node -e "require('http').get('http://localhost:3049/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) }).on('error', () => process.exit(1))" # Start the application CMD ["npm", "start"]