Files
111 998211c483 feat: 初始化考培练系统项目
- 从服务器拉取完整代码
- 按框架规范整理项目结构
- 配置 Drone CI 测试环境部署
- 包含后端(FastAPI)、前端(Vue3)、管理端

技术栈: Vue3 + TypeScript + FastAPI + MySQL
2026-01-24 19:33:28 +08:00

48 lines
1.2 KiB
Docker
Raw Permalink 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.
# 考培练系统管理后台前端 Dockerfile
# 多阶段构建Node.js 构建 + Nginx 运行
#
# 技术栈Vue 3 + TypeScript + pnpm符合瑞小美系统技术栈标准
# ============================================
# 阶段1构建
# ============================================
FROM node:20.11-alpine AS builder
WORKDIR /app
# 安装 pnpm符合规范使用 pnpm 包管理器)
RUN corepack enable && corepack prepare pnpm@9.0.0 --activate
# 设置 pnpm 镜像
RUN pnpm config set registry https://registry.npmmirror.com
# 安装依赖
COPY package.json pnpm-lock.yaml* ./
RUN pnpm install --frozen-lockfile || pnpm install
# 复制源码并构建
COPY . .
RUN pnpm run build
# ============================================
# 阶段2运行
# ============================================
FROM nginx:1.25.4-alpine
# 复制构建产物
COPY --from=builder /app/dist /usr/share/nginx/html
# 复制 nginx 配置
COPY nginx.conf /etc/nginx/conf.d/default.conf
# 暴露端口
EXPOSE 80
# 健康检查(符合规范)
HEALTHCHECK --interval=30s --timeout=10s --retries=3 \
CMD wget --no-verbose --tries=1 --spider http://localhost/ || exit 1
# 启动 nginx
CMD ["nginx", "-g", "daemon off;"]