fix: 修复 Dockerfile 中前端产物复制逻辑

- 修复 BUILD_IN_DOCKER=true 时 frontend/dist 不存在的问题
- 当 BUILD_IN_DOCKER=true 时,RUN 已经创建了 dist 目录
- COPY frontend/dist ./dist 现在应该能正常工作
This commit is contained in:
WrBug
2026-01-21 20:56:57 +08:00
parent 9c5517768f
commit 8889803dd7
+3 -4
View File
@@ -40,10 +40,9 @@ RUN if [ "$BUILD_IN_DOCKER" = "true" ]; then \
mkdir -p dist; \
fi
# 如果使用外部产物,从构建上下文复制外部编译的 dist
# 注意:这个 COPY 在 BUILD_IN_DOCKER=false 时必需
# 在 BUILD_IN_DOCKER=true 时,如果前端已编译,这个 COPY 会尝试覆盖,但结果相同
# 如果本地没有 distBUILD_IN_DOCKER=true 且未编译),这个 COPY 会失败,但上面的 RUN 已经编译了
# 仅在使用外部产物时复制 dist 目录到构建上下文
# 在 BUILD_IN_DOCKER=true 时,上面的 npm run build 已经创建了 dist
# 在 BUILD_IN_DOCKER=false 时,需要从构建上下文复制外部编译的 dist
COPY frontend/dist ./dist
# ==================== 阶段2:构建后端 ====================