From 1ce57c3ea20d5a02f9b838f1ce7ce20a7b171571 Mon Sep 17 00:00:00 2001 From: nfel Date: Tue, 4 Aug 2026 21:39:51 +0330 Subject: [PATCH] =?UTF-8?q?Fix=20worker=20rq=20not=20found=20=E2=80=94=20b?= =?UTF-8?q?uild=20venv=20natively=20in=20Playwright=20image?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The Playwright Noble image ships Python 3.12 while the builder uses python:3.11-slim. Copying the venv produced broken shebangs, causing "exec /app/.venv/bin/rq: no such file or directory". Fix: install uv in the worker stage and run uv sync natively so the venv targets this image's Python version. Manifests copied first for layer cache efficiency. Co-authored-by: Qwen-Coder --- Dockerfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Dockerfile b/Dockerfile index 737a860..e1e5458 100644 --- a/Dockerfile +++ b/Dockerfile @@ -49,6 +49,8 @@ EXPOSE 8000 CMD ["python", "main.py", "admin"] # ── Stage 2b: worker runtime (Playwright image with Chromium) ──────────────── +# The Playwright Noble image ships Python 3.12. Copying a venv built with +# python:3.11-slim would produce broken shebangs — so we build the venv here. FROM oci.reg.darano.ir//mcr.microsoft.com/playwright:v1.62.0-noble AS worker ENV PATH="/app/.venv/bin:$PATH" \ @@ -62,11 +64,15 @@ ENV PATH="/app/.venv/bin:$PATH" \ WORKDIR /app -# Copy application code -COPY . . +# Copy manifests + lockfile first (stable cache layer) +COPY pyproject.toml uv.lock* ./ -# Copy Python deps from builder stage -COPY --from=builder /app/.venv /app/.venv +# Install deps natively so the venv targets this image's Python +RUN pip install --no-cache-dir --upgrade uv==0.11.31 \ + && uv sync --frozen --no-dev --no-install-project + +# Copy app code (busts cache on code changes, not deps) +COPY . . # Playwright's Chromium is already downloaded and pre-patched with # undetected-chromedriver-friendly modifications, so no patch_driver run needed.