fix(container): keep the browser env alive where image ENV is dropped

This commit is contained in:
Ahmed Allam
2026-08-10 00:44:48 +00:00
parent 7b3c8f9b74
commit 771243f714
+15
View File
@@ -118,6 +118,21 @@ ENV AGENT_BROWSER_USER_AGENT="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36
ENV AGENT_BROWSER_ARGS="--disable-blink-features=AutomationControlled,--no-first-run,--no-default-browser-check,--lang=en-US"
ENV AGENT_BROWSER_SCREENSHOT_DIR=/workspace/.agent-browser-screenshots
ENV AGENT_BROWSER_IDLE_TIMEOUT_MS=180000
# Sandbox runtimes that build their own rootfs from this image (E2B and friends)
# boot their own init and drop the image's ENV, so also ship the values as a
# login-shell profile — agent commands run through `bash -lc`.
RUN set -eu; \
{ \
for var in AGENT_BROWSER_EXECUTABLE_PATH AGENT_BROWSER_USER_AGENT \
AGENT_BROWSER_ARGS AGENT_BROWSER_SCREENSHOT_DIR \
AGENT_BROWSER_IDLE_TIMEOUT_MS; do \
eval "value=\${$var}"; \
printf 'export %s="${%s:-%s}"\n' "$var" "$var" "$value"; \
done; \
} > /tmp/agent-browser.sh; \
install -m 0644 /tmp/agent-browser.sh /etc/profile.d/agent-browser.sh; \
rm /tmp/agent-browser.sh; \
env -i bash -lc 'test "${AGENT_BROWSER_IDLE_TIMEOUT_MS}" = "180000"'
RUN /home/pentester/.npm-global/bin/agent-browser doctor --offline --quick
RUN set -eux; \