优化docker镜像逻辑

This commit is contained in:
puke
2025-11-19 00:54:20 +08:00
parent c130628d41
commit 8f2ff82112

View File

@@ -49,16 +49,15 @@ COPY pyproject.toml uv.lock README.md ./
COPY pixelle_video ./pixelle_video COPY pixelle_video ./pixelle_video
# Install Python dependencies using uv with configurable index URL # Install Python dependencies using uv with configurable index URL
# Auto-select China mirror when USE_CN_MIRROR=true and UV_INDEX_URL is default # Create uv.toml config file to force using the mirror (most reliable method)
# Set longer timeout and use --default-index parameter to replace PyPI # Only create config when USE_CN_MIRROR=true, otherwise use default PyPI
# Note: --default-index replaces PyPI as the default source RUN if [ "$USE_CN_MIRROR" = "true" ]; then \
RUN if [ "$USE_CN_MIRROR" = "true" ] && [ "$UV_INDEX_URL" = "https://pypi.tuna.tsinghua.edu.cn/simple" ]; then \ echo '[[index]]' > uv.toml && \
export UV_HTTP_TIMEOUT=300 && \ echo "url = \"$UV_INDEX_URL\"" >> uv.toml && \
uv sync --frozen --no-dev --default-index https://pypi.tuna.tsinghua.edu.cn/simple; \ echo 'default = true' >> uv.toml; \
else \ fi && \
export UV_HTTP_TIMEOUT=300 && \ export UV_HTTP_TIMEOUT=300 && \
uv sync --frozen --no-dev --default-index $UV_INDEX_URL; \ uv sync --frozen --no-dev
fi
# Copy rest of application code # Copy rest of application code
COPY api ./api COPY api ./api