# Build stage FROM node:22 AS builder WORKDIR /app # Install pnpm via corepack RUN corepack enable && corepack prepare pnpm@latest --activate # Copy package manifests first for better caching COPY package.json pnpm-lock.yaml ./ # Copy the rest of the project COPY . . # Install deps and build RUN pnpm install --frozen-lockfile RUN pnpm build # Production image FROM nginx:stable COPY --from=builder /app/dist /usr/share/nginx/html # Add custom nginx config for SPA routing COPY docker/nginx.conf /etc/nginx/conf.d/default.conf EXPOSE 80 CMD ["nginx", "-g", "daemon off;"]