| # STEP 1: Install and build the Next.js app | |
| FROM node:20-alpine AS builder | |
| WORKDIR /app | |
| # Copy and install dependencies | |
| COPY package.json pnpm-lock.yaml* ./ | |
| RUN npm install -g pnpm && pnpm install | |
| # Copy rest of the project | |
| COPY . . | |
| # Build static site with Tailwind CSS | |
| RUN pnpm build && pnpm export | |
| # STEP 2: Serve with NGINX | |
| FROM nginx:alpine | |
| # Copy exported static site to NGINX's default public dir | |
| COPY --from=builder /app/out /usr/share/nginx/html | |
| # Expose port 80 | |
| EXPOSE 80 | |
| CMD ["nginx", "-g", "daemon off;"] | |