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:
+15
-13
@@ -14,15 +14,17 @@ FROM python:3.11-slim AS builder
|
||||
|
||||
WORKDIR /app
|
||||
|
||||
# Download the uv binary directly from GitHub releases (no install script quirks)
|
||||
RUN curl -LsSf https://github.com/astral-sh/uv/releases/latest/download/uv-x86_64-unknown-linux-gnu.tar.gz \
|
||||
| tar xz -C /usr/local/bin
|
||||
# Install uv — download the pre-built binary directly from GitHub releases
|
||||
# and add it to PATH for this layer.
|
||||
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* ./
|
||||
|
||||
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) ──────────────
|
||||
FROM ${BASE_IMAGE} AS admin
|
||||
@@ -32,7 +34,7 @@ WORKDIR /app
|
||||
ENV PATH="/app/.venv/bin:$PATH" \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
UV_INDEX_URL="http://pypi.reg.darano.ir/simple/"
|
||||
UV_DEFAULT_INDEX="https://pypi.reg.darano.ir"
|
||||
|
||||
COPY . .
|
||||
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.
|
||||
# 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' \
|
||||
> /etc/apt/sources.list.d/ubuntu.sources \
|
||||
&& apt-get update && apt-get install -y --no-install-recommends \
|
||||
python3 python3-venv \
|
||||
&& 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 \
|
||||
| tar xz -C /usr/local/bin
|
||||
&& curl -LsSf https://astral.sh/uv/install.sh | sh \
|
||||
&& ln -sf /usr/local/bin/uv /usr/local/bin/uv
|
||||
|
||||
ENV PATH="/app/.venv/bin:$PATH" \
|
||||
PYTHONUNBUFFERED=1 \
|
||||
PYTHONDONTWRITEBYTECODE=1 \
|
||||
UV_INDEX_URL="http://pypi.reg.darano.ir/simple/" \
|
||||
ENV PATH="/root/.local/bin:$PATH" \
|
||||
UV_DEFAULT_INDEX="https://pypi.reg.darano.ir" \
|
||||
# Chromium is pre-installed at /usr/bin/chromium
|
||||
CHROME_BINARY=/usr/bin/chromium \
|
||||
CHROMEDRIVER_PATH=/usr/bin/chromedriver \
|
||||
@@ -79,6 +78,9 @@ WORKDIR /app
|
||||
# Copy manifests first (stable cache layer)
|
||||
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 . .
|
||||
|
||||
|
||||
Reference in New Issue
Block a user