# BuildFlow Web (Vben Admin - web-antd) 多阶段构建 FROM node:22-alpine AS builder WORKDIR /app # 全局装 pnpm (与项目对齐) RUN npm install -g pnpm@9 # 先拷依赖清单利用层缓存 COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./ COPY apps/web-antd/package.json ./apps/web-antd/package.json # 拷贝 internal/scripts (turbo/vsh 工具链需要) COPY internal/ ./internal/ COPY scripts/ ./scripts/ RUN pnpm install --frozen-lockfile # 拷贝全部源码 COPY . . # 构建 web-antd 变体 (质量门禁: lint + typecheck 内含于 build) RUN pnpm build:antd # ---- 运行阶段: nginx 托管静态资源 ---- FROM nginx:1.27-alpine AS runtime COPY apps/web-antd/nginx.conf /etc/nginx/conf.d/default.conf 2>/dev/null || true COPY --from=builder /app/apps/web-antd/dist /usr/share/nginx/html EXPOSE 80 HEALTHCHECK --interval=30s --timeout=3s --retries=3 CMD wget -q --spider http://127.0.0.1/ || exit 1 CMD ["nginx", "-g", "daemon off;"]