fix(base): locate agent-browser's chrome arch-agnostically

v1.6.0's first build failed on amd64: playwright@latest fetches Chrome for
Testing, which extracts to chromium-<rev>/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.
This commit is contained in:
2026-07-17 17:55:21 +02:00
parent 649fc44c5b
commit 602e46c848
+6 -6
View File
@@ -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-<rev>` 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-* && \