build-flow.web/Dockerfile
xiangning 5696168bc3 fix(cicd): 修复 web 流水线 - 路径/构建脚本/飞书凭证/部署方式
- Dockerfile: apps/web-antd → apps/web-antdv-next(实际落点)
- Dockerfile: pnpm build:antd(不存在)→ turbo build --filter=@vben/web-antdv-next
- Dockerfile: 新增 nginx.conf(原 COPY 目标文件不存在导致 build 失败)
- Jenkinsfile: 移除飞书通知(凭证 feishu-* 未配,导致构建启动即 FAIL)
- Jenkinsfile: 部署 node(deploy-agent)→ SSH 直连 cd-target(无该 agent 节点)
- Jenkinsfile: 清除硬编码 webhook URL 明文
2026-07-17 11:21:46 +08:00

33 lines
1.3 KiB
Docker
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# BuildFlow Web (web-antdv-next / @vben/web-antdv-next) 多阶段构建
# 第一阶段:Node 22 构建 SPA 产物;第二阶段:Nginx 托管静态资源
FROM node:22-alpine AS builder
WORKDIR /app
# 全局装 pnpm(与本地 11.x 对齐;corepack 在 alpine 上不可靠)
RUN npm install -g pnpm@11
# 先拷依赖清单利用层缓存(pnpm workspace + turbo 需要这些清单文件齐备)
COPY package.json pnpm-lock.yaml pnpm-workspace.yaml turbo.json ./
COPY internal/ ./internal/
COPY scripts/ ./scripts/
COPY apps/web-antdv-next/package.json ./apps/web-antdv-next/package.json
# 拷贝其余 packages 的 package.json(workspace 依赖解析需要),但不拷 node_modules
COPY packages/ ./packages/
RUN pnpm install --frozen-lockfile
# 拷贝全部源码
COPY . .
# 构建 web-antdv-next 变体(turbo 按 workspace 名过滤;质量门禁内含 typecheck)
RUN pnpm run build --filter=@vben/web-antdv-next...
# ---- 运行阶段:Nginx 托管静态资源 ----
FROM nginx:1.27-alpine AS runtime
COPY apps/web-antdv-next/nginx.conf /etc/nginx/conf.d/default.conf
COPY --from=builder /app/apps/web-antdv-next/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;"]