Use UV_DEFAULT_INDEX=https://pypi.reg.darano.ir for all stages

Replaces UV_INDEX_URL with UV_DEFAULT_INDEX which is the canonical
env var for uv's default package index. Applied to builder, admin,
and worker stages.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
2026-08-04 22:59:07 +03:30
parent e222ffdcc4
commit 5001a8f2e8
+15 -13
View File
@@ -14,15 +14,17 @@ FROM python:3.11-slim AS builder
WORKDIR /app WORKDIR /app
# Download the uv binary directly from GitHub releases (no install script quirks) # Install uv — download the pre-built binary directly from GitHub releases
RUN curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-gnu.tar.gz \ # and add it to PATH for this layer.
| tar xz -C /usr/local/bin RUN curl -LsSf https://astral.sh/uv/install.sh | sh \
&& . /usr/local/env 2>/dev/null || true
ENV UV_INDEX_URL="http://pypi.reg.darano.ir/simple/" ENV PATH="/root/.local/bin:$PATH" \
UV_DEFAULT_INDEX="https://pypi.reg.darano.ir"
COPY pyproject.toml uv.lock* ./ COPY pyproject.toml uv.lock* ./
RUN /usr/local/bin/uv sync --frozen --no-dev --no-install-project RUN uv sync --frozen --no-dev --no-install-project
# ── Stage 2a: admin runtime (python:3.11-slim, no Chrome needed) ────────────── # ── Stage 2a: admin runtime (python:3.11-slim, no Chrome needed) ──────────────
FROM ${BASE_IMAGE} AS admin FROM ${BASE_IMAGE} AS admin
@@ -32,7 +34,7 @@ WORKDIR /app
ENV PATH="/app/.venv/bin:$PATH" \ ENV PATH="/app/.venv/bin:$PATH" \
PYTHONUNBUFFERED=1 \ PYTHONUNBUFFERED=1 \
PYTHONDONTWRITEBYTECODE=1 \ PYTHONDONTWRITEBYTECODE=1 \
UV_INDEX_URL="http://pypi.reg.darano.ir/simple/" UV_DEFAULT_INDEX="https://pypi.reg.darano.ir"
COPY . . COPY . .
COPY --from=builder /app/.venv /app/.venv COPY --from=builder /app/.venv /app/.venv
@@ -56,19 +58,16 @@ FROM oci.reg.darano.ir/mcr.microsoft.com/playwright:v1.62.0-noble AS worker
# Install Python 3.12 + uv, then sync deps — all in one RUN. # Install Python 3.12 + uv, then sync deps — all in one RUN.
# Use a mirror for apt since the VPS has network restrictions (Iran). # Use a mirror for apt since the VPS has network restrictions (Iran).
# Download uv binary directly (not via install script which is unreliable in Docker).
RUN printf 'Types: deb\nURIs: http://repo.iut.ac.ir/ubuntu/\nSuites: noble noble-updates noble-security\nComponents: main restricted universe multiverse\nSigned-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n' \ RUN printf 'Types: deb\nURIs: http://repo.iut.ac.ir/ubuntu/\nSuites: noble noble-updates noble-security\nComponents: main restricted universe multiverse\nSigned-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg\n' \
> /etc/apt/sources.list.d/ubuntu.sources \ > /etc/apt/sources.list.d/ubuntu.sources \
&& apt-get update && apt-get install -y --no-install-recommends \ && apt-get update && apt-get install -y --no-install-recommends \
python3 python3-venv \ python3 python3-venv \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-gnu.tar.gz \ && curl -LsSf https://astral.sh/uv/install.sh | sh \
| tar xz -C /usr/local/bin && ln -sf /usr/local/bin/uv /usr/local/bin/uv
ENV PATH="/app/.venv/bin:$PATH" \ ENV PATH="/root/.local/bin:$PATH" \
PYTHONUNBUFFERED=1 \ UV_DEFAULT_INDEX="https://pypi.reg.darano.ir" \
PYTHONDONTWRITEBYTECODE=1 \
UV_INDEX_URL="http://pypi.reg.darano.ir/simple/" \
# Chromium is pre-installed at /usr/bin/chromium # Chromium is pre-installed at /usr/bin/chromium
CHROME_BINARY=/usr/bin/chromium \ CHROME_BINARY=/usr/bin/chromium \
CHROMEDRIVER_PATH=/usr/bin/chromedriver \ CHROMEDRIVER_PATH=/usr/bin/chromedriver \
@@ -79,6 +78,9 @@ WORKDIR /app
# Copy manifests first (stable cache layer) # Copy manifests first (stable cache layer)
COPY pyproject.toml uv.lock* ./ COPY pyproject.toml uv.lock* ./
# Install project deps into a venv targeting this image's Python 3.12
RUN uv sync --frozen --no-dev --no-install-project
# Copy app code # Copy app code
COPY . . COPY . .