From fb35c549b51695ad78f939f8c2cca66a62a83e2d Mon Sep 17 00:00:00 2001 From: Joakim Persson Date: Fri, 17 Jul 2026 17:55:21 +0200 Subject: [PATCH] fix(base): locate agent-browser's chrome arch-agnostically MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit v1.6.0's first build failed on amd64: playwright@latest fetches Chrome for Testing, which extracts to chromium-/chrome-linux64/ on amd64 (vs chrome-linux/ on arm64). The hardcoded chrome-linux/ glob matched only arm64, so amd64 built no /usr/local/bin/agent-chrome symlink and 'test -x' failed (agent-browser --version had already printed 0.32.1 — the tell). Replace the glob with an arch-agnostic 'find -name chrome -path */chromium-*/*' (skips the chrome-headless-shell binary and the chromium_headless_shell dir), guarded by [ -n ] + the existing test -x. Verified locally: resolves the CfT chrome and agent-browser drives it headless. hadolint clean. --- Dockerfile.base | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile.base b/Dockerfile.base index eb94471..3cbb3ce 100644 --- a/Dockerfile.base +++ b/Dockerfile.base @@ -478,9 +478,10 @@ RUN curl -fsSL --retry 5 --retry-delay 5 --retry-all-errors https://deb.nodesour # Playwright honours PLAYWRIGHT_BROWSERS_PATH, so we place the browser under # /usr/local/share (never shadowed) and hand agent-browser a STABLE symlink # via AGENT_BROWSER_EXECUTABLE_PATH — the symlink insulates the ENV from -# Playwright's per-version `chromium-` directory name (glob picks the -# real headful build; the `chromium_headless_shell-*` dir has an underscore -# so `chromium-*` never matches it). +# Playwright's per-version, per-ARCH browser directory (`chrome-linux` on arm64, +# `chrome-linux64` on amd64 — Chrome-for-Testing), so we `find` the `chrome` +# binary rather than hardcode the path; the headless-shell binary is named +# `chrome-headless-shell`, so `-name chrome` skips it. # # `playwright install --with-deps chromium` also apt-installs Chromium's # runtime libs; verified to resolve correctly on Debian trixie (exit 0 — the @@ -499,9 +500,8 @@ RUN NPM_CONFIG_PREFIX=/usr npm install -g \ "agent-browser@${AGENT_BROWSER_VERSION}" \ "playwright@${PLAYWRIGHT_VERSION}" && \ playwright install --with-deps chromium && \ - for chrome in "${PLAYWRIGHT_BROWSERS_PATH}"/chromium-*/chrome-linux/chrome; do \ - ln -sf "$chrome" /usr/local/bin/agent-chrome; break; \ - done && \ + CHROME="$(find "${PLAYWRIGHT_BROWSERS_PATH}" -type f -name chrome -path '*/chromium-*/*' | head -n1)" && \ + [ -n "$CHROME" ] && ln -sf "$CHROME" /usr/local/bin/agent-chrome && \ agent-browser --version && \ test -x "$(readlink -f /usr/local/bin/agent-chrome)" && \ rm -rf "${PLAYWRIGHT_BROWSERS_PATH}"/chromium_headless_shell-* && \