FROM node:20-slim WORKDIR /app # Copy only package files first for better caching COPY package*.json ./ # Install dependencies with legacy peer deps RUN npm ci --legacy-peer-deps # Copy the rest of the application COPY . . # Build the Next.js app RUN npm run build # Expose the port EXPOSE 3000 # Use Node directly to avoid npm overhead CMD ["node", ".next/standalone/server.js"]