diff --git a/Dockerfile b/Dockerfile index 5ee4cc0..3be3959 100644 --- a/Dockerfile +++ b/Dockerfile @@ -33,9 +33,15 @@ RUN apt-get update && apt-get install -y \ && rm -rf /var/lib/apt/lists/* # Install uv package manager -RUN curl -LsSf https://astral.sh/uv/install.sh | sh && \ - /root/.local/bin/uv --version +# For China: use pip to install uv from mirror (faster and more stable) +# For International: use official installer script +RUN if [ "$USE_CN_MIRROR" = "true" ]; then \ + pip install --no-cache-dir -i https://mirrors.aliyun.com/pypi/simple/ uv; \ + else \ + curl -LsSf https://astral.sh/uv/install.sh | sh; \ + fi ENV PATH="/root/.local/bin:$PATH" +RUN uv --version # Copy dependency files and source code for building # Note: pixelle_video is needed for hatchling to build the package @@ -45,9 +51,9 @@ COPY pixelle_video ./pixelle_video # Install Python dependencies using uv with configurable index URL # Auto-select Aliyun mirror when USE_CN_MIRROR=true and UV_INDEX_URL is default RUN if [ "$USE_CN_MIRROR" = "true" ] && [ "$UV_INDEX_URL" = "https://pypi.org/simple" ]; then \ - /root/.local/bin/uv sync --frozen --no-dev --index-url https://mirrors.aliyun.com/pypi/simple/; \ + uv sync --frozen --no-dev --index-url https://mirrors.aliyun.com/pypi/simple/; \ else \ - /root/.local/bin/uv sync --frozen --no-dev --index-url $UV_INDEX_URL; \ + uv sync --frozen --no-dev --index-url $UV_INDEX_URL; \ fi # Copy rest of application code @@ -71,5 +77,5 @@ ENV CHROME_BIN=/usr/bin/chromium EXPOSE 8000 8501 # Default command (can be overridden in docker-compose) -CMD ["/root/.local/bin/uv", "run", "python", "api/app.py"] +CMD ["uv", "run", "python", "api/app.py"] diff --git a/docker-compose.yml b/docker-compose.yml index 270ef3f..46768ed 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -22,7 +22,7 @@ services: USE_CN_MIRROR: ${USE_CN_MIRROR:-false} UV_INDEX_URL: ${UV_INDEX_URL:-https://pypi.org/simple} container_name: pixelle-video-api - command: /root/.local/bin/uv run python api/app.py --host 0.0.0.0 --port 8000 + command: uv run python api/app.py --host 0.0.0.0 --port 8000 ports: - "8000:8000" volumes: @@ -61,7 +61,7 @@ services: USE_CN_MIRROR: ${USE_CN_MIRROR:-false} UV_INDEX_URL: ${UV_INDEX_URL:-https://pypi.org/simple} container_name: pixelle-video-web - command: /root/.local/bin/uv run streamlit run web/app.py --server.port 8501 --server.address 0.0.0.0 + command: uv run streamlit run web/app.py --server.port 8501 --server.address 0.0.0.0 ports: - "8501:8501" volumes: