Spaces:
Running
Running
File size: 3,066 Bytes
1428d20 b9d12d1 d3062ba 9a4cb29 b9d12d1 30000cd b9d12d1 1428d20 b9d12d1 1428d20 b9d12d1 29e3514 5534b90 b9d12d1 1428d20 b9d12d1 9a4cb29 b9d12d1 1428d20 | 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 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 | # HuggingMes - Hermes Agent Gateway for Hugging Face Spaces
ARG HERMES_AGENT_VERSION=latest
FROM nousresearch/hermes-agent:${HERMES_AGENT_VERSION}
USER root
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
curl \
jq \
python3 \
chromium \
libnss3 \
libatk1.0-0 \
libatk-bridge2.0-0 \
libdrm2 \
libgbm1 \
libxcomposite1 \
libxdamage1 \
libxrandr2 \
libxkbcommon0 \
libx11-6 \
libxext6 \
libxfixes3 \
libasound2 \
fonts-dejavu-core \
fonts-liberation \
fonts-noto-color-emoji \
&& rm -rf /var/lib/apt/lists/* \
&& uv pip install --python /opt/hermes/.venv/bin/python --no-cache-dir huggingface_hub hf_transfer
COPY --chown=hermes:hermes start.sh /opt/huggingmes/start.sh
COPY --chown=hermes:hermes health-server.js /opt/huggingmes/health-server.js
COPY --chown=hermes:hermes hermes-sync.py /opt/huggingmes/hermes-sync.py
COPY --chown=hermes:hermes cloudflare-proxy-setup.py /opt/huggingmes/cloudflare-proxy-setup.py
COPY --chown=hermes:hermes cloudflare-keepalive-setup.py /opt/huggingmes/cloudflare-keepalive-setup.py
RUN chmod +x \
/opt/huggingmes/start.sh \
/opt/huggingmes/hermes-sync.py \
/opt/huggingmes/cloudflare-proxy-setup.py \
/opt/huggingmes/cloudflare-keepalive-setup.py
# Patch kanban migration: wrap ALTER TABLE ADD COLUMN in try/except so a
# persisted DB with the column already present doesn't crash the gateway.
RUN python3 - <<'PY'
from pathlib import Path
import sys
p = Path("/opt/hermes/hermes_cli/kanban_db.py")
if not p.exists():
sys.exit(0)
src = p.read_text(encoding="utf-8")
sentinel = "# huggingmes: idempotent-alter"
if sentinel in src:
sys.exit(0)
old = (
' conn.execute(\n'
' "ALTER TABLE tasks ADD COLUMN consecutive_failures "\n'
' "INTEGER NOT NULL DEFAULT 0"\n'
' )'
)
new = (
f' try: {sentinel}\n'
' conn.execute(\n'
' "ALTER TABLE tasks ADD COLUMN consecutive_failures "\n'
' "INTEGER NOT NULL DEFAULT 0"\n'
' )\n'
' except Exception:\n'
' pass'
)
if old not in src:
print("kanban patch: pattern not found — may be fixed upstream, skipping")
sys.exit(0)
p.write_text(src.replace(old, new), encoding="utf-8")
print("kanban patch: applied")
PY
# Ensure hermes CLI is discoverable in ALL shell types (login, interactive,
# non-interactive). /etc/profile.d/ is sourced by login shells after /etc/profile
# resets PATH, so this survives even full environment resets.
RUN echo 'export PATH="/opt/hermes/.venv/bin:/opt/data/.local/bin:$PATH"' \
> /etc/profile.d/hermes-venv.sh
ENV HERMES_HOME=/opt/data \
HUGGINGMES_APP_DIR=/opt/huggingmes \
HERMES_AGENT_VERSION=${HERMES_AGENT_VERSION} \
PYTHONUNBUFFERED=1 \
PLAYWRIGHT_CHROMIUM_EXECUTABLE_PATH=/usr/bin/chromium
EXPOSE 7861
HEALTHCHECK --interval=30s --timeout=5s --start-period=90s \
CMD curl -fsS http://localhost:7861/health || exit 1
CMD ["/opt/huggingmes/start.sh"]
|