# Ideas Generator 2025 - Backend Dockerfile FROM node:18-alpine # Set working directory WORKDIR /app # Install system dependencies RUN apk add --no-cache \ python3 \ make \ g++ \ postgresql-client # Copy package files COPY server/package*.json ./ # Install dependencies RUN npm ci --only=production && npm cache clean --force # Copy server source code COPY server/ ./ # Create non-root user RUN addgroup -g 1001 -S nodejs && \ adduser -S backend -u 1001 -G nodejs # Change ownership of app directory RUN chown -R backend:nodejs /app USER backend # Health check HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ CMD node -e "require('http').get('http://localhost:3000/health', (res) => { process.exit(res.statusCode === 200 ? 0 : 1) })" # Expose port EXPOSE 3000 # Start the application CMD ["npm", "start"]