# Hermes Agent (NousResearch, v2026.9.21) behind the CLI shim + a small control gateway,
# driving Qwen3.8 Flash on OpenRouter. Adapted from gx10
# ~/code/vlmtest/agents/hermes/Dockerfile. No GPU. At run time m64 puts the container on an
# internal network whose only egress is its gate (HTTP(S)_PROXY); the gate adds the
# OpenRouter key to plain http://openrouter.ai requests, so the key never enters the container.
#
# Base: debian:12-slim, pinned by its multi-arch index digest.
FROM debian@sha256:99c0b25c46d0214d5a2091092e7908907dcaecd6a962cde0ac700acee222b6f3

RUN apt-get update && apt-get install -y --no-install-recommends \
      ca-certificates curl git jq unzip xz-utils procps \
      python3 python3-venv python3-pip ripgrep build-essential \
    && rm -rf /var/lib/apt/lists/*

# Hermes's own installer, taken from the pinned commit (the v2026.9.21 tag) and checked by
# sha256, then told to check out that same commit. It provisions a sha256-pinned uv and
# installs Python deps from the repo's lock (pm/lock.json). As root it puts the code in
# /usr/local/lib/hermes-agent and links `hermes` into /usr/local/bin. The browser and
# computer-use stacks are skipped (gigabytes, and the sandbox has no display).
ARG HERMES_COMMIT=d337b736aa1e8ebecfab043842d13e4a2d2f48a3
RUN curl -fsSL "https://raw.githubusercontent.com/NousResearch/hermes-agent/${HERMES_COMMIT}/scripts/install.sh" -o /tmp/install.sh \
    && echo "00f9080c6452bf87f03ef2fffb4b2c23b9f43f946aaae956e4c547d17e310b22  /tmp/install.sh" | sha256sum -c - \
    && bash /tmp/install.sh --branch main --commit "${HERMES_COMMIT}" \
         --non-interactive --skip-setup --skip-browser --skip-computer-use \
    && rm -f /tmp/install.sh \
    && hermes --version

# Gateway deps, the same pinned set as the opencode capsule's gateway (Python 3.11).
RUN python3 -m venv /opt/gateway && /opt/gateway/bin/pip install --no-cache-dir \
      fastapi==0.115.14 uvicorn==0.32.1 httpx==0.28.1 \
      starlette==0.46.2 pydantic==2.14.1 pydantic_core==2.50.1 annotated-types==0.8.0 \
      typing_extensions==4.16.0 typing-inspection==0.4.4 anyio==4.15.1 idna==3.20 \
      certifi==2026.10.23 httpcore==1.0.9 h11==0.16.0 click==8.5.0

RUN useradd -m -u 1000 agent
USER agent
WORKDIR /scratch
