chore(infra): docker dev-apps stack + apollo-router v1.45 compat
- 新增 docker-compose.dev-apps.yml:7 个应用服务容器化
(iam/classes/core-edu/content/msg/push-gateway/api-gateway)
+ apollo-router override
- 新增 apollo-router dev-apps-entrypoint.sh / dev-apps-supergraph.yaml
仅等待 5 个子图(iam/core-edu/content/msg/config-service)
避免等待未启动的 ai/data-ana
- router.yaml:移除 v1.45 不兼容键
(require_manifest/manifest_path/max_cost/max_batch_size)
移除 ELv2 受限特性(persisted_queries/limits.max_depth)
自托管无 GraphOS license
- docker-compose.yml:config-service 添加 NODE_ENV=production
修复 pino-pretty devDep 误用
apollo-router 添加 APOLLO_PERSISTED_QUERIES env
- services/{classes,core-edu,content,config-service}/Dockerfile
重写为 repo 根 context + shared-ts/shared-proto 工作区依赖
+ --ignore-scripts
修复 ERR_PNPM_WORKSPACE_PKG_NOT_FOUND 与 ERR_PNPM_IGNORED_BUILDS
- api-gateway healthcheck:wget --spider 改为 wget -O /dev/null
修复 busybox 对 200+body 误报 exit 8
This commit is contained in:
@@ -1,46 +1,56 @@
|
||||
# Build stage
|
||||
# 构建上下文必须是仓库根目录(需访问 packages/shared-ts 与 pnpm-workspace.yaml)
|
||||
FROM node:22-alpine AS builder
|
||||
WORKDIR /app
|
||||
RUN corepack enable && corepack prepare pnpm@11.13.0 --activate
|
||||
|
||||
# 复制 workspace 根配置
|
||||
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml tsconfig.base.json ./
|
||||
# 复制 workspace 配置 + tsconfig 基线
|
||||
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml tsconfig.base.json ./
|
||||
|
||||
# 复制 shared-proto(proto 文件运行时需要)
|
||||
COPY packages/shared-proto/package.json packages/shared-proto/
|
||||
COPY packages/shared-proto/proto packages/shared-proto/proto
|
||||
# 复制 shared-proto(gRPC proto-loader 运行时加载)
|
||||
COPY packages/shared-proto ./packages/shared-proto
|
||||
|
||||
# 复制 content 服务
|
||||
COPY services/content/package.json services/content/tsconfig.json services/content/nest-cli.json ./services/content/
|
||||
COPY services/content/src ./services/content/src
|
||||
# 复制 shared-ts(workspace 依赖)
|
||||
COPY packages/shared-ts ./packages/shared-ts
|
||||
|
||||
# 安装依赖(不执行 scripts)
|
||||
RUN pnpm install --frozen-lockfile --ignore-scripts
|
||||
# 复制 content 源码
|
||||
COPY services/content ./services/content
|
||||
|
||||
# 构建
|
||||
RUN cd services/content && pnpm build
|
||||
# HUSKY=0 跳过根 package.json 的 prepare:husky 脚本
|
||||
ENV HUSKY=0
|
||||
|
||||
# 只安装 content 及其 workspace 依赖(@edu/shared-ts、@edu/shared-proto)
|
||||
# --ignore-scripts:跳过 @apollo/protobufjs 等的 postinstall(content 无原生模块依赖)
|
||||
RUN pnpm install --no-frozen-lockfile --ignore-scripts --filter @edu/content-service...
|
||||
|
||||
# 构建 shared-ts(content 依赖 @edu/shared-ts dist 产物)
|
||||
RUN cd packages/shared-ts && pnpm build
|
||||
|
||||
# 构建 content
|
||||
WORKDIR /app/services/content
|
||||
RUN pnpm build
|
||||
|
||||
# Runtime stage
|
||||
FROM node:22-alpine
|
||||
WORKDIR /app
|
||||
RUN corepack enable && corepack prepare pnpm@11.13.0 --activate
|
||||
|
||||
# 复制 workspace 配置
|
||||
COPY pnpm-workspace.yaml package.json pnpm-lock.yaml tsconfig.base.json ./
|
||||
# 复制 workspace 配置 + tsconfig 基线
|
||||
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml tsconfig.base.json ./
|
||||
|
||||
# 复制 shared-proto(运行时加载 proto 文件)
|
||||
COPY packages/shared-proto/package.json packages/shared-proto/
|
||||
COPY packages/shared-proto/proto packages/shared-proto/proto
|
||||
# 复制 shared-proto + shared-ts(运行时需要:proto 文件 + shared-ts dist)
|
||||
COPY packages/shared-proto ./packages/shared-proto
|
||||
COPY packages/shared-ts ./packages/shared-ts
|
||||
|
||||
# 复制 content 服务 package.json
|
||||
COPY services/content/package.json ./services/content/
|
||||
# 复制 content 源码
|
||||
COPY services/content ./services/content
|
||||
|
||||
# 安装生产依赖
|
||||
RUN pnpm install --prod --frozen-lockfile --ignore-scripts
|
||||
|
||||
# 复制构建产物
|
||||
# 从 builder 复制已编译的 prod node_modules + content dist + shared-ts dist
|
||||
COPY --from=builder /app/services/content/node_modules ./services/content/node_modules
|
||||
COPY --from=builder /app/packages/shared-ts/node_modules ./packages/shared-ts/node_modules
|
||||
COPY --from=builder /app/node_modules ./node_modules
|
||||
COPY --from=builder /app/services/content/dist ./services/content/dist
|
||||
COPY --from=builder /app/packages/shared-ts/dist ./packages/shared-ts/dist
|
||||
|
||||
EXPOSE 3005 50054
|
||||
WORKDIR /app/services/content
|
||||
EXPOSE 3005 50054
|
||||
CMD ["node", "dist/main.js"]
|
||||
|
||||
Reference in New Issue
Block a user