Spaces:
Running
Running
| # Stage 1: Build | |
| FROM node:22-alpine AS builder | |
| RUN corepack enable && corepack prepare pnpm@latest --activate | |
| WORKDIR /app | |
| COPY pnpm-workspace.yaml package.json pnpm-lock.json* ./ | |
| RUN pnpm install --no-frozen-lockfile | |
| COPY . . | |
| RUN pnpm build | |
| # Stage 2: Serve | |
| FROM nginx:alpine | |
| COPY --from=builder /app/dist /usr/share/nginx/html | |
| # SPA fallback: route all requests to index.html | |
| RUN printf 'server {\n\ | |
| listen 7860;\n\ | |
| root /usr/share/nginx/html;\n\ | |
| index index.html;\n\ | |
| location / {\n\ | |
| try_files $uri $uri/ /index.html;\n\ | |
| }\n\ | |
| }\n' > /etc/nginx/conf.d/default.conf | |
| EXPOSE 7860 | |
| CMD ["nginx", "-g", "daemon off;"] | |