fix: 修复本地 Docker 构建时 frontend/dist 和 backend/build 不存在的问题

- 移除 Dockerfile 中无效的 COPY frontend/dist 指令
- 改进前端构建逻辑,添加外部产物检查
- 改进后端构建逻辑,支持复制外部构建的 JAR 文件
- 在 deploy.sh 中添加创建占位符目录步骤,避免 COPY 失败
- 保持与 GitHub Actions 构建流程的兼容性(BUILD_IN_DOCKER=false)

修复了本地使用 ./deploy.sh 部署时的构建错误:
"failed to calculate checksum: /frontend/dist: not found"
This commit is contained in:
WrBug
2026-01-21 21:04:25 +08:00
parent 8889803dd7
commit 419c68c024
2 changed files with 36 additions and 12 deletions
+4
View File
@@ -168,6 +168,10 @@ deploy() {
info "构建 Docker 镜像(本地构建,版本号: ${DOCKER_VERSION}..."
# 创建占位符目录(如果不存在),避免 Dockerfile COPY 失败
# 当 BUILD_IN_DOCKER=true 时,backend/build 可能不存在
mkdir -p backend/build/libs
# 设置构建参数(通过环境变量传递给 docker-compose.yml
export VERSION=${DOCKER_VERSION}
export GIT_TAG=${DOCKER_VERSION}