ci: align gitea workflow and frontend build
This commit is contained in:
@@ -4,9 +4,13 @@ on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
- master
|
||||
- ui-change
|
||||
- 'feature/**'
|
||||
- 'fix/**'
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- ui-change
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
@@ -46,7 +50,7 @@ jobs:
|
||||
- name: Run pytest
|
||||
run: |
|
||||
source .venv/bin/activate
|
||||
pytest tests/ -v --tb=short || echo "⚠️ 部分测试失败(可能需要数据库连接)"
|
||||
pytest tests/ -v --tb=short
|
||||
|
||||
# ─────────────────────────────────────────────
|
||||
# 前端 Vue 构建检查
|
||||
@@ -72,11 +76,7 @@ jobs:
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
if [ -f package-lock.json ]; then
|
||||
npm ci
|
||||
else
|
||||
npm install
|
||||
fi
|
||||
npm ci
|
||||
|
||||
- name: Build
|
||||
run: npm run build
|
||||
|
||||
+10
-10
@@ -1,17 +1,17 @@
|
||||
# ============================================================
|
||||
# Stage 1: Build — 基于 Node 18 Alpine 构建 Vue3 前端产物
|
||||
# ============================================================
|
||||
FROM node:18-alpine AS builder
|
||||
# Stage 1: Build — 基于 Node 20 Alpine 构建 Vue3 前端产物
|
||||
# ============================================================
|
||||
FROM node:20-alpine AS builder
|
||||
|
||||
WORKDIR /build
|
||||
|
||||
# 先拷贝依赖清单,利用 Docker 层缓存
|
||||
COPY frontend/package.json frontend/package-lock.json* ./
|
||||
RUN npm install
|
||||
|
||||
# 拷贝全部前端源码并执行生产构建
|
||||
COPY frontend/ .
|
||||
RUN npm install -D @types/node && npm run build
|
||||
# 先拷贝依赖清单,利用 Docker 层缓存
|
||||
COPY frontend/package.json frontend/package-lock.json* ./
|
||||
RUN npm ci
|
||||
|
||||
# 拷贝全部前端源码并执行生产构建
|
||||
COPY frontend/ .
|
||||
RUN npm run build
|
||||
|
||||
# ============================================================
|
||||
# Stage 2: Run — 极致轻量的 Nginx 运行时
|
||||
|
||||
Reference in New Issue
Block a user