From 80a4c5f6ad8f2f71a879ec1b2ceb13c591afbd37 Mon Sep 17 00:00:00 2001 From: WinJay Date: Thu, 12 Mar 2026 15:48:21 +0800 Subject: [PATCH 1/2] fix(api): use relative baseURL to fix docker deployment API requests This fixes the issue where the frontend in docker tries to connect to localhost instead of the Vite proxy. --- frontend/src/api/index.js | 2 +- frontend/vite.config.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/frontend/src/api/index.js b/frontend/src/api/index.js index e2d9465b..60e8e0da 100644 --- a/frontend/src/api/index.js +++ b/frontend/src/api/index.js @@ -2,7 +2,7 @@ import axios from 'axios' // 创建axios实例 const service = axios.create({ - baseURL: import.meta.env.VITE_API_BASE_URL || 'http://localhost:5001', + baseURL: import.meta.env.VITE_API_BASE_URL || '', timeout: 300000, // 5分钟超时(本体生成可能需要较长时间) headers: { 'Content-Type': 'application/json' diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 7cec1a71..e9e4aab5 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -6,7 +6,6 @@ export default defineConfig({ plugins: [vue()], server: { port: 3000, - open: true, proxy: { '/api': { target: 'http://localhost:5001', From f55bc70fde896d294592ceec84af9dd0816be540 Mon Sep 17 00:00:00 2001 From: WinJay Date: Thu, 12 Mar 2026 16:11:26 +0800 Subject: [PATCH 2/2] chore(docker): optimize build with domestic mirrors Replace ghcr.io/astral-sh/uv with pip install using aliyun mirror to prevent hanging. Also configure npm and uv to use domestic registry/mirror. --- Dockerfile | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index e6564686..19d05d07 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,12 +1,13 @@ FROM python:3.11 # 安装 Node.js (满足 >=18)及必要工具 -RUN apt-get update \ +RUN sed -i 's|deb.debian.org|mirrors.aliyun.com|g' /etc/apt/sources.list.d/debian.sources \ + && apt-get update \ && apt-get install -y --no-install-recommends nodejs npm \ && rm -rf /var/lib/apt/lists/* -# 从 uv 官方镜像复制 uv -COPY --from=ghcr.io/astral-sh/uv:0.9.26 /uv /uvx /bin/ +# 通过 pip 安装 uv(替代直接拉取 ghcr.io 官方镜像,避免国内网络卡顿) +RUN pip install -i https://mirrors.aliyun.com/pypi/simple/ uv WORKDIR /app @@ -15,10 +16,11 @@ COPY package.json package-lock.json ./ COPY frontend/package.json frontend/package-lock.json ./frontend/ COPY backend/pyproject.toml backend/uv.lock ./backend/ -# 安装依赖(Node + Python) -RUN npm ci \ +# 安装依赖(Node + Python),配置国内加速源 +RUN npm config set registry https://registry.npmmirror.com \ + && npm ci \ && npm ci --prefix frontend \ - && cd backend && uv sync --frozen + && cd backend && env UV_INDEX_URL=https://mirrors.aliyun.com/pypi/simple/ uv sync --frozen # 复制项目源码 COPY . .