FROM node:20-slim AS builder ENV PNPM_HOME="/pnpm" ENV PATH="$PNPM_HOME:$PATH" ENV NODE_OPTIONS=--max-old-space-size=8192 ENV TZ=Asia/Shanghai RUN corepack enable WORKDIR /app # Copy all source files COPY . /app # Install dependencies and build only web-naive RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile RUN pnpm run build --filter=@vben/web-naive RUN echo "Build success" # ── Production image ────────────────────────────────────────────────────────── FROM nginx:stable-alpine AS production # Support .mjs files RUN echo 'types { application/javascript js mjs; }' > /etc/nginx/conf.d/mjs.conf # Copy built files COPY --from=builder /app/apps/web-naive/dist /usr/share/nginx/html # Copy nginx config COPY scripts/deploy/nginx.conf /etc/nginx/nginx.conf # HuggingFace Spaces exposes port 7860 EXPOSE 7860 CMD ["nginx", "-g", "daemon off;"]