FROM node:18-alpine WORKDIR /app # Install curl for health checks and other utilities RUN apk add --no-cache curl git # Copy package files COPY package*.json ./ # Install dependencies (dev mode) RUN npm install # Copy source code COPY . . # Create non-root user RUN addgroup -g 1001 -S nodejs RUN adduser -S nextjs -u 1001 # Change ownership RUN chown -R nextjs:nodejs /app USER nextjs # Expose port EXPOSE 3000 # Health check HEALTHCHECK --interval=30s --timeout=10s --start-period=10s --retries=3 \ CMD curl -f http://localhost:3000 || exit 1 # Start development server with hot reload CMD ["npm", "run", "dev", "--", "--host", "0.0.0.0"]