🐛 fix(docker/web-server): 修复前端构建缺失 shared/i18n 导致 CI 失败

- frontend 阶段改为 monorepo 布局 WORKDIR /src/frontend
- COPY shared/ 到 /src/shared,恢复 catalog/messages/translate 相对路径解析
- dist 产物路径同步为 /src/frontend/dist
- 新增 Dockerfile 布局回归校验脚本,避免再次漏拷 shared
This commit is contained in:
Syngnat
2026-07-09 11:16:30 +08:00
parent 26c22379ae
commit f930ffe153
3 changed files with 48 additions and 2 deletions

View File

@@ -5,10 +5,14 @@
FROM --platform=$BUILDPLATFORM node:20-bookworm AS frontend
WORKDIR /frontend
# 使用 monorepo 布局frontend 源码通过相对路径 ../../../shared/i18n 引用仓库 shared/
# (见 frontend/src/i18n/catalog.ts、shared/i18n/messages.ts、shared/i18n/translate.ts
# 仅 COPY frontend/ 会导致 tsc 报 Cannot find module '../../../shared/i18n/*'。
WORKDIR /src/frontend
COPY frontend/package.json frontend/package-lock.json ./
RUN npm ci --no-audit --no-fund
COPY frontend/ ./
COPY shared/ /src/shared/
# wailsjs 绑定已入库;容器内只构建静态前端
RUN npm run build
@@ -25,7 +29,7 @@ COPY third_party/go-irisnative/go.mod third_party/go-irisnative/go.sum ./third_p
RUN go mod download
COPY . .
COPY --from=frontend /frontend/dist ./frontend/dist
COPY --from=frontend /src/frontend/dist ./frontend/dist
# 纯 Go 构建主程序web-server 模式不需要 Wails WebView / CGO
RUN CGO_ENABLED=0 GOOS=${TARGETOS} GOARCH=${TARGETARCH} \