Skip to content

Commit 6357f85

Browse files
authored
Merge pull request #2067 from reallav0/agent/include-playwright-headless-shell
fix(docker): include Playwright headless shell
2 parents a8ab4ce + b4e1551 commit 6357f85

2 files changed

Lines changed: 17 additions & 2 deletions

File tree

Dockerfile

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,9 @@ RUN crawl4ai-setup
178178
RUN playwright install --with-deps
179179

180180
RUN mkdir -p /home/appuser/.cache/ms-playwright \
181-
&& cp -r /root/.cache/ms-playwright/chromium-* /home/appuser/.cache/ms-playwright/ \
181+
&& cp -r /root/.cache/ms-playwright/chromium-* \
182+
/root/.cache/ms-playwright/chromium_headless_shell-* \
183+
/home/appuser/.cache/ms-playwright/ \
182184
&& chown -R appuser:appuser /home/appuser/.cache/ms-playwright
183185

184186
RUN crawl4ai-doctor
@@ -227,4 +229,4 @@ ENV PYTHON_ENV=production
227229
# Start via entrypoint.sh, which resolves the socket-level auth/egress posture
228230
# (loopback unless a credential is present) and the redis password, then execs
229231
# supervisord.
230-
CMD ["bash", "entrypoint.sh"]
232+
CMD ["bash", "entrypoint.sh"]

deploy/docker/tests/test_security_container_posture.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,19 @@ def test_artifact_dir_created_0700(self, dockerfile):
5757
assert "/var/lib/crawl4ai/outputs" in dockerfile
5858
assert "chmod 700 /var/lib/crawl4ai/outputs" in dockerfile
5959

60+
def test_playwright_headless_shell_is_copied_to_runtime_cache(self, dockerfile):
61+
# Playwright launches chromium_headless_shell for headless crawls. The
62+
# image runs as appuser, so both Chromium artifacts must be copied out
63+
# of root's install cache.
64+
cache_copy = re.search(
65+
r"cp -r(?P<artifacts>(?:(?!&&).)*)/home/appuser/\.cache/ms-playwright/",
66+
dockerfile,
67+
re.DOTALL,
68+
)
69+
assert cache_copy, "Dockerfile must copy Playwright artifacts into appuser's cache"
70+
assert "chromium-*" in cache_copy.group("commands")
71+
assert "chromium_headless_shell-*" in cache_copy.group("commands")
72+
6073
def test_runs_as_non_root(self, dockerfile):
6174
assert re.search(r"^USER\s+appuser", dockerfile, re.MULTILINE)
6275

0 commit comments

Comments
 (0)