# Persistent Hermes Agent (Nous Research) on a Hugging Face Space. # Connected to OpenRouter with subagent spawning (delegate_task / orchestration). # # Layout: # - Runtime (hermes venv + launcher) baked INTO the image at build time. # - HERMES data (~/.hermes: config, .env, memories, skills, sessions, cron) # lives on the /data volume (private bucket) → persistent across restarts. # - Entrypoint swaps ~/.hermes → /data and seeds the volume on first boot. FROM ubuntu:22.04 ENV DEBIAN_FRONTEND=noninteractive \ LANG=C.UTF-8 \ LC_ALL=C.UTF-8 \ HOME=/root # System prerequisites + enable 'universe' so ripgrep / ffmpeg are available. RUN . /etc/os-release \ && printf 'deb http://archive.ubuntu.com/ubuntu %s universe\ndeb http://archive.ubuntu.com/ubuntu %s-updates universe\n' "$VERSION_CODENAME" "$VERSION_CODENAME" >> /etc/apt/sources.list \ && apt-get update \ && apt-get install -y --no-install-recommends \ git \ curl \ ca-certificates \ build-essential \ pkg-config \ libssl-dev \ libffi-dev \ python3-dev \ ripgrep \ ffmpeg \ tzdata \ && rm -rf /var/lib/apt/lists/* # Install Hermes Agent at BUILD time (root FHS layout): # code+venv -> /usr/local/lib/hermes-agent # launcher -> /usr/local/bin/hermes # node/uv/etc -> /root/.hermes (moved to a seed dir below) RUN curl -fsSL https://hermes-agent.nousresearch.com/install.sh \ | bash -s -- \ --non-interactive \ --skip-setup # Pre-build the web dashboard UI so the runtime never needs npm (--skip-build). # The installer keeps its managed Node under ~/.hermes/node/bin. # Only runs if the package shipped a `web/` source dir (dev installs may skip it). RUN if [ -d /usr/local/lib/hermes-agent/web ]; then \ export PATH="/root/.hermes/node/bin:$PATH"; \ cd /usr/local/lib/hermes-agent/web \ && npm install --no-audit --no-fund \ && npm run build; \ fi # Preserve the build-time ~/.hermes (managed node, uv, bundled skills) as a seed # the runtime entrypoint copies into the persistent volume on first boot. RUN rm -rf /hermes-seed && mkdir -p /hermes-seed \ && mv /root/.hermes/* /hermes-seed/ 2>/dev/null || true \ && ls -la /hermes-seed | head -40 ENV PATH=/usr/local/bin:/usr/bin:/bin COPY entrypoint.sh /usr/local/bin/entrypoint.sh RUN chmod +x /usr/local/bin/entrypoint.sh WORKDIR /root EXPOSE 7860 ENTRYPOINT ["/usr/local/bin/entrypoint.sh"]