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.