From e222ffdcc4be4e5c870b7f494dfaf31d6a8441f6 Mon Sep 17 00:00:00 2001 From: nfel Date: Tue, 4 Aug 2026 22:49:55 +0330 Subject: [PATCH] Download uv binary directly from GitHub releases instead of install script The install script puts binaries in unexpected places and the shell used in RUN (dash) doesn't have /usr/local/bin in PATH. Downloading the pre-built binary directly from GitHub releases and extracting it to /usr/local/bin/ where it's immediately accessible. Co-authored-by: Qwen-Coder --- Dockerfile | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Dockerfile b/Dockerfile index 9304ddb..7b0b66a 100644 --- a/Dockerfile +++ b/Dockerfile @@ -12,17 +12,17 @@ ARG BASE_IMAGE=python:3.11-slim # ── Stage 1: dependency resolver ───────────────────────────────────────────── FROM python:3.11-slim AS builder -# Install uv via curl (not pip) to avoid any PyPI/network dependency -RUN curl -LsSf https://astral.sh/uv/install.sh | \ - UV_INSTALL_DIR=/usr/local sh - 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 + ENV UV_INDEX_URL="http://pypi.reg.darano.ir/simple/" COPY pyproject.toml uv.lock* ./ -RUN /usr/local/uv/bin/uv sync --frozen --no-dev --no-install-project +RUN /usr/local/bin/uv sync --frozen --no-dev --no-install-project # ── Stage 2a: admin runtime (python:3.11-slim, no Chrome needed) ────────────── FROM ${BASE_IMAGE} AS admin @@ -54,17 +54,16 @@ CMD ["python", "main.py", "admin"] 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 so PATH is consistent. +# Install Python 3.12 + uv, then sync deps — all in one RUN. # Use a mirror for apt since the VPS has network restrictions (Iran). -# curl is already installed (playwright system dep). +# 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://astral.sh/uv/install.sh | \ - UV_INSTALL_DIR=/usr/local sh \ - && /usr/local/uv/bin/uv sync --frozen --no-dev --no-install-project + && 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 ENV PATH="/app/.venv/bin:$PATH" \ PYTHONUNBUFFERED=1 \