The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
feat(docker): ship the Webapp renderer in the image
IAvecilla25a6a44c4aab
diff --git a/.dockerignore b/.dockerignoreindex 55981d59b3b..b090120f136 100644--- a/.dockerignore+++ b/.dockerignore@@ -76,12 +76,20 @@ runtime/# ---------- Not needed inside the Docker image -----------# Desktop app source (Tauri/Electron); never installed in the container.+# Desktop app source (Tauri/Electron); the app is never installed in the container.# apps/shared is the dashboard↔desktop websocket helper and is linked from# web/package.json as a file: workspace dep — keep it in the build context.+# apps/desktop is the Webapp renderer's build input (webapp_build stage); its+# local build outputs stay out.apps/!apps/shared/!apps/shared/**+!apps/desktop/+!apps/desktop/**+apps/desktop/dist/+apps/desktop/dist-webapp/+apps/desktop/build/+apps/desktop/release/# Test suite — not shipped in production imagestests/diff --git a/Dockerfile b/Dockerfileindex d7fa4f76666..1ca25d1732f 100644--- a/Dockerfile+++ b/Dockerfile@@ -322,6 +322,16 @@ COPY --from=icons /tmp/hermes-icons /tmp/hermes-iconsRUN node scripts/build/tui.mjs --source /opt/hermes --out /opt/products/tui && \node scripts/build/web.mjs --source /opt/hermes --icons /tmp/hermes-icons --out /opt/products/web+# The Webapp (the browser-hosted Desktop) builds through its source recipe,+# which installs Desktop's dependencies in a private workspace. A stage of its+# own so Desktop changes leave the TUI and dashboard layers cached.+FROM runtime_base AS webapp_build+COPY package.json package-lock.json .npmrc ./+COPY apps/ apps/+COPY scripts/build/*.mjs scripts/build/+ENV npm_config_install_links=false+RUN node apps/desktop/scripts/build-webapp.mjs+FROM python_deps AS runtime# Standalone TypeScript linting is a runtime feature; Vite/esbuild are not.COPY --from=frontend_build /opt/hermes/node_modules/typescript /opt/hermes/node_modules/typescript@@ -347,6 +357,7 @@ RUN cd plugins/platforms/photon/sidecar && \# Shared product outputs are independent of application dependency assembly.COPY --from=frontend_build /opt/products/tui /opt/hermes/ui-tuiCOPY --from=frontend_build /opt/products/web /opt/hermes/hermes_cli/web_dist+COPY --from=webapp_build /opt/hermes/apps/desktop/dist-webapp /opt/hermes/apps/desktop/dist-webapp# ---------- Bot Screen X socket directory ----------# Xvnc would create this itself (/tmp is 1777); pre-creating it keeps ownership# deterministic when HERMES_UID is remapped between boots.diff --git a/tests/docker/test_webapp_bundle.py b/tests/docker/test_webapp_bundle.pynew file mode 100644index 00000000000..0c8e4e5a0e1--- /dev/null+++ b/tests/docker/test_webapp_bundle.py@@ -0,0 +1,26 @@+"""The image ships the Webapp renderer where the gateway serves it from.++The install root is read-only, so ``hermes webapp`` cannot build the bundle at+runtime: a gateway with ``webapp.enabled`` serves only what the build baked.+"""+from __future__ import annotations++import shlex+import subprocess+++def test_webapp_bundle_is_baked_where_the_gateway_serves_it(built_image: str) -> None:+ py = (+ "from hermes_cli.config import get_project_root; "+ "from hermes_cli.webapp import webapp_bundle_stale, webapp_dist_dir; "+ "dist = webapp_dist_dir(get_project_root()); "+ "assert (dist / 'index.html').is_file(), dist; "+ "assert not webapp_bundle_stale(dist), dist"+ )+ inner = f"source /opt/hermes/.venv/bin/activate && cd /opt/hermes && python3 -c {shlex.quote(py)}"+ r = subprocess.run(+ ["docker", "run", "--rm", "--network=none", "--entrypoint", "su", built_image,+ "hermes", "-s", "/bin/bash", "-c", inner],+ capture_output=True, text=True, timeout=120, check=False,+ )+ assert r.returncode == 0, f"Webapp bundle missing from the image:\n{r.stderr[-2000:]}"