From 8f2ff82112b5b2cd61faffb3d4b08ed6b73ef3b0 Mon Sep 17 00:00:00 2001 From: puke <1129090915@qq.com> Date: Wed, 19 Nov 2025 00:54:20 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96docker=E9=95=9C=E5=83=8F?= =?UTF-8?q?=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index a5116ac..b2c27fa 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,16 +49,15 @@ COPY pyproject.toml uv.lock README.md ./ COPY pixelle_video ./pixelle_video # Install Python dependencies using uv with configurable index URL -# Auto-select China mirror when USE_CN_MIRROR=true and UV_INDEX_URL is default -# Set longer timeout and use --default-index parameter to replace PyPI -# Note: --default-index replaces PyPI as the default source -RUN if [ "$USE_CN_MIRROR" = "true" ] && [ "$UV_INDEX_URL" = "https://pypi.tuna.tsinghua.edu.cn/simple" ]; then \ - export UV_HTTP_TIMEOUT=300 && \ - uv sync --frozen --no-dev --default-index https://pypi.tuna.tsinghua.edu.cn/simple; \ - else \ - export UV_HTTP_TIMEOUT=300 && \ - uv sync --frozen --no-dev --default-index $UV_INDEX_URL; \ - fi +# Create uv.toml config file to force using the mirror (most reliable method) +# Only create config when USE_CN_MIRROR=true, otherwise use default PyPI +RUN if [ "$USE_CN_MIRROR" = "true" ]; then \ + echo '[[index]]' > uv.toml && \ + echo "url = \"$UV_INDEX_URL\"" >> uv.toml && \ + echo 'default = true' >> uv.toml; \ + fi && \ + export UV_HTTP_TIMEOUT=300 && \ + uv sync --frozen --no-dev # Copy rest of application code COPY api ./api