From 36393d7adf1e9144cc1618d512548754833e3207 Mon Sep 17 00:00:00 2001 From: Battleplus <3559424769@qq.com> Date: Sat, 22 Aug 2026 11:01:21 +0000 Subject: [PATCH] fix(docker): remove build-time browser and core-dump waste Install Playwright and Patchright browsers directly into appuser's runtime cache in the same Docker layer instead of installing under root and copying them later. Restrict the explicit Playwright install to Chromium. Delete doctor-generated core dumps from APP_HOME and temporary/home paths in the same layer that runs the doctor, so the files are not retained in image history. Fixes #2092 Signed-off-by: Battleplus <3559424769@qq.com> --- Dockerfile | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index 3b39e307d..6187eae02 100644 --- a/Dockerfile +++ b/Dockerfile @@ -173,17 +173,13 @@ RUN pip install --no-cache-dir --upgrade pip && \ python -c "import crawl4ai; print('✅ crawl4ai is ready to rock!')" && \ python -c "from playwright.sync_api import sync_playwright; print('✅ Playwright is feeling dramatic!')" -RUN crawl4ai-setup - -RUN playwright install --with-deps - RUN mkdir -p /home/appuser/.cache/ms-playwright \ - && cp -r /root/.cache/ms-playwright/chromium-* \ - /root/.cache/ms-playwright/chromium_headless_shell-* \ - /home/appuser/.cache/ms-playwright/ \ + && PLAYWRIGHT_BROWSERS_PATH=/home/appuser/.cache/ms-playwright crawl4ai-setup \ + && PLAYWRIGHT_BROWSERS_PATH=/home/appuser/.cache/ms-playwright playwright install --with-deps chromium \ && chown -R appuser:appuser /home/appuser/.cache/ms-playwright -RUN crawl4ai-doctor +RUN crawl4ai-doctor \ + && (find "${APP_HOME}" /tmp /var/tmp /home -name '*.core' -delete 2>/dev/null || true) # Ensure all cache directories belong to appuser # This fixes permission issues with .cache/url_seeder and other runtime cache dirs