Spaces:
Paused
Paused
File size: 2,405 Bytes
9ff800f 0de4f33 9ff800f 0de4f33 9ff800f 310c3e1 0de4f33 310c3e1 0de4f33 9ff800f 310c3e1 0de4f33 310c3e1 0de4f33 9a866b1 a4462b0 9a866b1 310c3e1 9a866b1 310c3e1 9ff800f 6df5984 9ff800f cf7ef89 310c3e1 9a866b1 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | FROM nousresearch/hermes-agent:latest
# One public port (7860) fronts both surfaces:
# /v1/* -> gateway API 8642 (Open WebUI and other OpenAI clients)
# /* -> dashboard 9119 (browser UI, /api/ws, /api/pty)
# Both backends bind 0.0.0.0 so the dashboard auth gate stays engaged.
ENV HERMES_DASHBOARD=1 \
HERMES_DASHBOARD_HOST=0.0.0.0 \
HERMES_DASHBOARD_PORT=9119 \
HERMES_HOME=/opt/data \
HERMES_GATEWAY_BOOTSTRAP_STATE=running \
API_SERVER_HOST=0.0.0.0 \
API_SERVER_PORT=8642 \
HERMES_BUCKET=tkgray/hermes-data \
HERMES_SNAPSHOT=hermes-data.tgz \
SYNC_INTERVAL=900 \
PORT=7860
USER root
# uv + the two libraries the image lacks: huggingface_hub (bucket snapshots)
# and aiohttp (the port multiplexer).
RUN curl -LsSf https://astral.sh/uv/install.sh | env UV_INSTALL_DIR=/usr/local/bin sh \
&& /usr/local/bin/uv pip install --python /opt/hermes/.venv/bin/python --no-cache-dir \
"huggingface_hub>=2.4" \
&& /opt/hermes/.venv/bin/python -c "import huggingface_hub as h; print('[build] hub', h.__version__)"
# nginx fronts the single public port: it proxies websockets and Set-Cookie
# correctly by design. The hand-rolled aiohttp version kept dropping session
# cookies (dict-collapsed Set-Cookie) and killing /api/pty with 403s.
RUN apt-get update \
&& apt-get install -y --no-install-recommends nginx-light \
&& rm -rf /var/lib/apt/lists/* \
&& mkdir -p /var/lib/nginx/body /var/lib/nginx/proxy /var/lib/nginx/fastcgi \
&& chown -R hermes:hermes /var/lib/nginx \
&& nginx -v
RUN mkdir -p /opt/bucket /opt/data && chown -R hermes:hermes /opt/data
COPY --chmod=0755 bucket_sync.py /opt/bucket/bucket_sync.py
COPY --chmod=0644 nginx.conf /opt/bucket/nginx.conf
COPY --chmod=0755 entry.sh /opt/bucket/entry.sh
# Memory sampler fix: /proc/meminfo reports the HOST's memory inside a container,
# so a busy neighbour made this Space read as "critical" pressure and blocked
# kanban dispatch every tick ("spawning no new workers"). The patcher makes
# sample_memory() prefer the container's own cgroup limit and fails the build
# loudly if the anchor is missing (image layout changed).
COPY --chmod=0755 patch_cgroup_mem.py /opt/bucket/patch_cgroup_mem.py
RUN /opt/hermes/.venv/bin/python /opt/bucket/patch_cgroup_mem.py
EXPOSE 7860
ENTRYPOINT ["/opt/bucket/entry.sh"]
CMD ["nginx", "-c", "/opt/bucket/nginx.conf", "-g", "daemon off;"]
|