| # ============================================================================= | |
| # Hermes Agent — Hugging Face Spaces (Docker SDK) 部署镜像 | |
| # 继承官方 nousresearch/hermes-agent 镜像,改用 Hugging Face Buckets 做备份 | |
| # =========================================================================== | |
| FROM nousresearch/hermes-agent:latest | |
| USER root | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends \ | |
| ca-certificates \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 安装 Hugging Face CLI(用于 buckets sync 备份/恢复) | |
| RUN uv pip install --python /opt/hermes/.venv/bin/python "huggingface_hub[cli]" | |
| ENV HERMES_HOME=/opt/data \ | |
| HF_SPACE=1 | |
| ENV API_SERVER_ENABLED=true \ | |
| API_SERVER_HOST=127.0.0.1 \ | |
| API_SERVER_PORT=8642 | |
| ENV HERMES_DASHBOARD=1 \ | |
| HERMES_DASHBOARD_HOST=0.0.0.0 \ | |
| HERMES_DASHBOARD_PORT=7860 | |
| # s6 cont-init.d 脚本(在 s6-rc 服务启动前运行): | |
| # 009-hf-setup : 拷贝 config 模板 + SOUL.md(官方 01-hermes-setup 之前) | |
| # 099-hf-finalize : 注入 Telegram 反代 base_url + 修属主 + 启动 HF Bucket 定时备份 | |
| # 关键:Telegram base_url 必须在 gateway 启动前写入 config.yaml,否则 gateway 直连 | |
| # api.telegram.org(HF 出站不通)。所以必须放 cont-init.d 而非 entrypoint。 | |
| COPY cont-init-setup.sh /etc/cont-init.d/009-hf-setup | |
| COPY cont-init-finalize.sh /etc/cont-init.d/099-hf-finalize | |
| COPY hf-bucket-sync.sh /opt/hermes-hf/hf-bucket-sync.sh | |
| COPY hf-bucket-restore.sh /opt/hermes-hf/hf-bucket-restore.sh | |
| COPY config.yaml /opt/hermes-hf/config.template.yaml | |
| COPY SOUL.md /opt/hermes-hf/SOUL.md | |
| COPY entrypoint.sh /opt/hermes-hf/entrypoint.sh | |
| RUN chmod +x /etc/cont-init.d/009-hf-setup /etc/cont-init.d/099-hf-finalize \ | |
| /opt/hermes-hf/hf-bucket-sync.sh /opt/hermes-hf/hf-bucket-restore.sh \ | |
| /opt/hermes-hf/entrypoint.sh | |
| ENTRYPOINT ["/init", "/opt/hermes-hf/entrypoint.sh"] | |
| CMD ["gateway", "run"] | |