Files
Edu/services/teacher-bff/Dockerfile
SpecialX 99155a5ea1 feat(teacher-bff): 完整实现 teacher-bff GraphQL 聚合层
包含 clients/graphql/middleware、health probes、shared-ts contracts 等
2026-07-10 19:10:07 +08:00

48 lines
1.2 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.
# Build stage
FROM node:20-alpine AS builder
WORKDIR /app
RUN npm install -g pnpm
# 复制 workspace 配置
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml ./
# 复制 shared-protogRPC proto-loader 运行时加载)
COPY packages/shared-proto ./packages/shared-proto
# 复制 shared-tsGraphQL schema 文件)
COPY packages/shared-ts ./packages/shared-ts
# 复制 teacher-bff 源码
COPY services/teacher-bff ./services/teacher-bff
# 安装依赖(仅 teacher-bff + shared-ts
RUN cd services/teacher-bff && pnpm install --frozen-lockfile
# 构建
WORKDIR /app/services/teacher-bff
RUN pnpm build
# Runtime stage
FROM node:20-alpine
WORKDIR /app
RUN npm install -g pnpm
# 复制 workspace 配置
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml ./
# 复制 shared-proto + shared-ts运行时需要
COPY packages/shared-proto ./packages/shared-proto
COPY packages/shared-ts ./packages/shared-ts
# 复制 teacher-bff
COPY services/teacher-bff ./services/teacher-bff
WORKDIR /app/services/teacher-bff
RUN pnpm install --prod --frozen-lockfile
# 复制构建产物
COPY --from=builder /app/services/teacher-bff/dist ./dist
EXPOSE 3003
CMD ["node", "dist/main.js"]