fix(docker): 优化 Vite 配置以支持 Docker 构建环境

- 修改 vite.config.ts 在 Docker 环境中使用当前目录加载 .env 文件
- 在 Dockerfile 中设置 DOCKER_BUILD 环境变量
- 移除不必要的 .env.example 复制步骤

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
huangjianwu
2026-03-23 18:54:16 +08:00
parent cb5c11d41a
commit 499366da02
2 changed files with 6 additions and 4 deletions

View File

@@ -36,10 +36,10 @@ WORKDIR /tmp/frontend
COPY ./BillNote_frontend/package.json ./
RUN pnpm install
# 复制 .env.example 到父目录,供 vite.config.ts 使用
COPY ./.env.example /tmp/.env
COPY ./BillNote_frontend /tmp/frontend
# 设置环境变量,告诉 vite.config.ts 这是 Docker 构建
ENV DOCKER_BUILD=1
RUN pnpm run build
# === 阶段3完整应用镜像 ===