# ───────────────────────────────────────────────────────────── # Hermes Agent ☤ (Nous Research) + LiteLLM free-key router # running 24/7 on a FREE Hugging Face Docker Space # ───────────────────────────────────────────────────────────── FROM python:3.12-slim # xz-utils/unzip/bzip2: the installer unpacks uv/python/node tarballs — slim lacks them RUN apt-get update && apt-get install -y --no-install-recommends \ curl git ca-certificates bash xz-utils unzip bzip2 build-essential \ && rm -rf /var/lib/apt/lists/* # LiteLLM proxy (the multi-key router) in its own venv ENV VIRTUAL_ENV=/opt/venv RUN python3 -m venv /opt/venv \ && /opt/venv/bin/pip install --no-cache-dir "litellm[proxy]" "uvicorn[standard]" # HF Spaces run the container as uid 1000 RUN useradd -m -u 1000 agent USER agent ENV HOME=/home/agent ENV PATH="/opt/venv/bin:/home/agent/.local/bin:/home/agent/.hermes/bin:$PATH" # Official Hermes installer, hardened for containers: # --non-interactive never prompt (prompts EOF-abort under docker build) # --skip-setup no onboarding wizard (we ship our own config) # --skip-browser no playwright/chromium (heavy; re-enable later if wanted) # --skip-computer-use skip desktop automation extras RUN curl -fsSL https://hermes-agent.nousresearch.com/install.sh -o /tmp/hermes-install.sh \ && bash /tmp/hermes-install.sh --non-interactive --skip-setup \ --skip-browser --skip-computer-use \ && rm -f /tmp/hermes-install.sh # fail the BUILD loudly right here if the hermes command didn't land RUN bash -lc 'command -v hermes && (hermes --version || true)' WORKDIR /home/agent/app COPY --chown=agent:agent gen_router_config.py gen_hermes_config.py health_server.py entrypoint.sh ./ RUN chmod +x entrypoint.sh # HF hardcoded public port — the health/status page lives here EXPOSE 7860 HEALTHCHECK --interval=60s --timeout=10s --start-period=240s --retries=5 \ CMD curl -sf http://127.0.0.1:7860/healthz || exit 1 CMD ["./entrypoint.sh"]