# Use official Node.js 20 LTS image FROM node:20-alpine # Set working directory WORKDIR /app # Install dependencies first (better caching) COPY package*.json ./ RUN npm ci --production # Copy source files (including .next build output if pre-built) COPY . . # If you want to build inside container, uncomment: # RUN npm run build # Use non-root user (optional, but recommended) RUN addgroup -S appgroup && adduser -S appuser -G appgroup USER appuser # Expose port your app listens on EXPOSE 3000 # Start your Next.js app (adjust if using custom server) CMD ["npm", "start"]