feat: 初始化考培练系统项目
- 从服务器拉取完整代码 - 按框架规范整理项目结构 - 配置 Drone CI 测试环境部署 - 包含后端(FastAPI)、前端(Vue3)、管理端 技术栈: Vue3 + TypeScript + FastAPI + MySQL
This commit is contained in:
47
admin-frontend/Dockerfile
Normal file
47
admin-frontend/Dockerfile
Normal file
@@ -0,0 +1,47 @@
|
||||
# 考培练系统管理后台前端 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;"]
|
||||
|
||||
Reference in New Issue
Block a user