docker/sandbox-desktop.Dockerfile streamed the cua-driver release asset straight into tar, so whatever the server returned became a root-owned binary on PATH in the published default terminal sandbox. Fetch to a file and sha256sum -c it against committed per-arch digests first, the way the root Dockerfile already handles SQLite and s6-overlay. Add scripts/ci/check_dockerfile_downloads.py (repo-guards step and `scripts/check --only dockerfile-downloads`) so no tracked Dockerfile can pipe a download into an extractor or interpreter again. Fixes #126942 Co-authored-by: Yuan Li <dskwelmcy@163.com>
102 lines
6.0 KiB
Docker
102 lines
6.0 KiB
Docker
# Terminal-backend sandbox image WITH a desktop: the default sandbox base every
|
|
# docker/modal/daytona/singularity user already runs (nikolaik/python-nodejs), plus
|
|
# the tools that base was missing, plus the same display stack the -desktop Hermes
|
|
# image carries (TigerVNC + Xfce components + headed Chromium) and cua-driver, so
|
|
# Bot Screen, computer_use and the browser can live INSIDE the sandbox instead of
|
|
# on the gateway host. No Hermes runtime in here; the gateway shells in.
|
|
#
|
|
# docker build -f docker/sandbox-desktop.Dockerfile -t nousresearch/hermes-sandbox:desktop .
|
|
#
|
|
# Published as nousresearch/hermes-sandbox:desktop by .github/workflows/sandbox-image.yml
|
|
# after each stable release, weekly, and on manual dispatch: it carries no Hermes code, so it
|
|
# does not track main, but the weekly rebuild picks up base-image and apt security fixes.
|
|
# The tag lives in the ARG so CI and a local build read one place; hadolint cannot
|
|
# see through the substitution, hence the inline ignore.
|
|
ARG SANDBOX_BASE=nikolaik/python-nodejs:python3.13-nodejs26
|
|
# hadolint ignore=DL3006
|
|
FROM ${SANDBOX_BASE}
|
|
SHELL ["/bin/bash", "-euo", "pipefail", "-c"]
|
|
|
|
ARG CUA_DRIVER_VERSION=0.28.2
|
|
# sha256 of cua-driver-rs-<version>-linux-<arch>-binary.tar.gz, checked before extraction:
|
|
# the tarball becomes a root-owned binary on PATH in the published default sandbox, so a
|
|
# replaced release asset must fail the build. Re-hash both assets when bumping the version.
|
|
ARG CUA_DRIVER_X86_64_SHA256=a1d99fd04bb4927ef5ffdbe60eb91ed8b51a2bab60e10fc604a75bd59ce69c3e
|
|
ARG CUA_DRIVER_ARM64_SHA256=55e8a32839a4ac369a773df4dac87b345bd4567779221ade4a5e39223a45a2e8
|
|
ARG TARGETARCH
|
|
|
|
ENV DEBIAN_FRONTEND=noninteractive \
|
|
PLAYWRIGHT_BROWSERS_PATH=/opt/playwright \
|
|
LANG=C.UTF-8
|
|
|
|
# Everyday tools the nikolaik base lacks (checked 2026-09: no jq, rg, fd, tmux,
|
|
# less, vim/nano, zip, rsync, tree, procps beyond ps). Kept to what agents reach
|
|
# for from a shell; language toolchains come from the base.
|
|
RUN apt-get -o Acquire::Retries=3 update && \
|
|
apt-get -o Acquire::Retries=3 install -y --no-install-recommends \
|
|
jq ripgrep fd-find tmux less nano vim-tiny zip rsync tree procps htop \
|
|
file bsdextrautils ca-certificates locales sudo && \
|
|
ln -sf /usr/bin/fdfind /usr/local/bin/fd && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Display stack: identical package set to the Hermes -desktop image (Dockerfile,
|
|
# HERMES_BOT_DESKTOP=1) so tools/bot_desktop/launcher.sh finds the same binaries.
|
|
# Components are launched individually by the launcher, never xfce4-session.
|
|
RUN apt-get -o Acquire::Retries=3 update && \
|
|
apt-get -o Acquire::Retries=3 install -y --no-install-recommends \
|
|
tigervnc-standalone-server xfce4-panel xfwm4 xfdesktop4 xfce4-settings xfce4-terminal \
|
|
dbus-x11 x11-xserver-utils x11-utils x11-xkb-utils xauth fonts-dejavu-core \
|
|
at-spi2-core libgtk-3-0 libnss3 libasound2 libxss1 && \
|
|
rm -rf /var/lib/apt/lists/*
|
|
|
|
# Headed Chromium through Playwright (the same build the Hermes -desktop image
|
|
# uses), so the agent's browser and the dock's Browser icon share one binary and
|
|
# one --user-data-dir: tools/bot_desktop/sandbox_host.py finds it under
|
|
# /opt/playwright. --with-deps pulls the Chromium runtime libraries.
|
|
RUN for i in 1 2 3; do \
|
|
npx --yes playwright@1 install --with-deps chromium && break || \
|
|
{ [ "$i" = 3 ] && exit 1; echo "playwright chromium install failed (attempt $i); retrying in 10s"; sleep 10; }; \
|
|
done && chmod -R a+rX /opt/playwright
|
|
|
|
# cua-driver: computer_use's MCP driver. Pinned release tarball from the
|
|
# cua-driver-rs-v* tags (never releases/latest: prereleases publish 0 assets).
|
|
RUN set -eu; \
|
|
case "${TARGETARCH:-amd64}" in \
|
|
amd64) arch=x86_64; sha="${CUA_DRIVER_X86_64_SHA256}" ;; \
|
|
arm64) arch=arm64; sha="${CUA_DRIVER_ARM64_SHA256}" ;; \
|
|
*) echo "unsupported TARGETARCH ${TARGETARCH}"; exit 1 ;; \
|
|
esac; \
|
|
mkdir -p /opt/cua-driver; \
|
|
curl -fsSL --retry 3 -o /tmp/cua-driver.tar.gz \
|
|
"https://github.com/trycua/cua/releases/download/cua-driver-rs-v${CUA_DRIVER_VERSION}/cua-driver-rs-${CUA_DRIVER_VERSION}-linux-${arch}-binary.tar.gz"; \
|
|
printf '%s %s\n' "${sha}" /tmp/cua-driver.tar.gz | sha256sum -c -; \
|
|
tar -xzf /tmp/cua-driver.tar.gz -C /opt/cua-driver; \
|
|
rm -f /tmp/cua-driver.tar.gz; \
|
|
ln -sf /opt/cua-driver/cua-driver /usr/local/bin/cua-driver; \
|
|
/usr/local/bin/cua-driver --version
|
|
|
|
# Pillow: the Screen pane's thumbnail is grabbed INSIDE the sandbox (the X socket and its cookie live
|
|
# here, not on the gateway host). Also used by the base for ad-hoc image work.
|
|
RUN pip install --no-cache-dir "pillow>=10" && python3 -c "from PIL import ImageGrab"
|
|
|
|
# The base's default user stays root, exactly like nikolaik today, so existing
|
|
# docker_image users see no ownership or PATH change. Desktop processes (Xvnc,
|
|
# Xfce, Chromium, cua-driver) are exec'd as the base's unprivileged `pn` (uid
|
|
# 1000): Chromium refuses to run as root without --no-sandbox and cua-driver's
|
|
# AT-SPI bus wants a real user session. `pn` may sudo for ad-hoc installs.
|
|
RUN echo "pn ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/pn && chmod 0440 /etc/sudoers.d/pn && \
|
|
mkdir -p /tmp/.X11-unix && chmod 1777 /tmp/.X11-unix && \
|
|
mkdir -p /tmp/hermes-runtime && chown pn:pn /tmp/hermes-runtime && chmod 0700 /tmp/hermes-runtime
|
|
|
|
# Runtime dir for dbus/Xvnc; containers have no logind to create it. Both /tmp
|
|
# paths above are fixed by the X11 protocol / seeded per container, never shared.
|
|
ENV XDG_RUNTIME_DIR=/tmp/hermes-runtime
|
|
# Dockerfile ENV reaches `docker exec` only. When this image is the target of the
|
|
# ssh backend (sshd added on top), a login session gets its environment from PAM,
|
|
# so the browser location must also live where pam_env reads it, or Playwright
|
|
# launched over ssh without an explicit executable path (agent or user scripts)
|
|
# looks in ~/.cache/ms-playwright and finds no browser while working under
|
|
# docker exec.
|
|
RUN printf 'PLAYWRIGHT_BROWSERS_PATH=/opt/playwright\nXDG_RUNTIME_DIR=/tmp/hermes-runtime\n' >> /etc/environment
|
|
CMD ["sleep", "infinity"]
|