# Build stage FROM node:20-alpine AS builder RUN corepack enable && corepack prepare pnpm@10.28.2 --activate WORKDIR /app # Copy everything (filtered by .dockerignore) COPY . . # Install deps with hoisting RUN echo "node-linker=hoisted" > .npmrc RUN pnpm install --frozen-lockfile # Build web ENV NEXT_PUBLIC_API_URL=http://localhost:3001 RUN cd apps/web && ../../node_modules/.bin/next build # Runtime stage FROM node:20-alpine WORKDIR /app # Copy standalone output COPY --from=builder /app/apps/web/.next/standalone ./ COPY --from=builder /app/apps/web/.next/static ./apps/web/.next/static COPY --from=builder /app/apps/web/public ./apps/web/public EXPOSE 3000 ENV PORT=3000 ENV HOSTNAME=0.0.0.0 CMD ["node", "apps/web/server.js"]