# Build stage FROM node:20-alpine AS builder WORKDIR /app # Install pnpm RUN corepack enable && corepack prepare pnpm@latest --activate # Copy package files COPY package.json pnpm-lock.yaml ./ # Install dependencies RUN pnpm install --frozen-lockfile # Copy source code COPY . . # Build the static export RUN pnpm build # Production stage - nginx to serve static files FROM nginx:alpine # Copy custom nginx config for SPA routing COPY nginx.conf /etc/nginx/conf.d/default.conf # Copy the static export from builder # Next.js static export outputs to 'out' folder COPY --from=builder /app/out /usr/share/nginx/html # Expose port 80 EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]