feat(teacher-portal): 完整实现 teacher-portal 微前端

包含 settings/students/api、graphql、mocks、ui-tokens 设计令牌等
This commit is contained in:
SpecialX
2026-07-10 19:10:20 +08:00
parent 14d836beb0
commit 1eacd1ed87
48 changed files with 3897 additions and 1056 deletions

View File

@@ -1,5 +1,6 @@
# 多阶段构建Next.js 生产镜像
# 用法docker build -t edu/teacher-portal:latest -f apps/teacher-portal/Dockerfile .
# 端口规范teacher-portal :4000matrix.md §1 微前端层)
# ============ Builder ============
FROM node:20-alpine AS builder
@@ -8,14 +9,20 @@ WORKDIR /app
# 启用 pnpm
RUN corepack enable && corepack prepare pnpm@9.12.0 --activate
# 先拷依赖清单,利用缓存
# 先拷依赖清单,利用缓存(含 workspace 共享包)
COPY package.json pnpm-lock.yaml* pnpm-workspace.yaml* ./
COPY apps/teacher-portal/package.json ./apps/teacher-portal/
COPY packages/ui-tokens/package.json ./packages/ui-tokens/
COPY packages/ui-components/package.json ./packages/ui-components/
COPY packages/hooks/package.json ./packages/hooks/
# 安装依赖(含 devDependencies构建需要
RUN pnpm install --filter @edu/teacher-portal... --frozen-lockfile || pnpm install --filter @edu/teacher-portal...
# 拷源码
COPY apps/teacher-portal ./apps/teacher-portal
COPY packages/ui-tokens ./packages/ui-tokens
COPY packages/ui-components ./packages/ui-components
COPY packages/hooks ./packages/hooks
# 构建(禁用 telemetry生产模式
ENV NEXT_TELEMETRY_DISABLED=1
@@ -27,7 +34,7 @@ WORKDIR /app
ENV NODE_ENV=production
ENV NEXT_TELEMETRY_DISABLED=1
ENV PORT=3000
ENV PORT=4000
# 非 root 用户运行
RUN addgroup -g 1001 -S nodejs && adduser -S nextjs -u 1001
@@ -40,10 +47,10 @@ COPY --from=builder /app/node_modules ./node_modules
COPY --from=builder /app/apps/teacher-portal/next.config.js ./next.config.js
USER nextjs
EXPOSE 3000
EXPOSE 4000
# 健康检查
# 健康检查/api/health liveness 端点)
HEALTHCHECK --interval=30s --timeout=5s --start-period=20s --retries=3 \
CMD wget --quiet --spider http://localhost:3000/ || exit 1
CMD wget --quiet --spider http://localhost:4000/api/health || exit 1
CMD ["node_modules/.bin/next", "start", "-p", "3000"]
CMD ["node_modules/.bin/next", "start", "-p", "4000"]