Download Dockerfile from R1000/Hermex: direct link, hf CLI and curl.
- Browser
- Download file 4.79 kB
-
https://huggingface.co/spaces/R1000/Hermex/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/R1000/Hermex/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/R1000/Hermex/resolve/main/Dockerfile
4.79 kB
| FROM ghcr.io/astral-sh/uv:0.11.6-python3.13-trixie@sha256:b3c543b6c4f23a5f2df22866bd7857e5d304b67a564f4feab6ac22044dde719b AS uv_source | |
| FROM tianon/gosu:1.19-trixie@sha256:3b176695959c71e123eb390d427efc665eeb561b1540e82679c15e992006b8b9 AS gosu_source | |
| FROM node:23-bookworm-slim | |
| ENV PYTHONUNBUFFERED=1 \ | |
| TZ=Asia/Bangkok \ | |
| PLAYWRIGHT_BROWSERS_PATH=/opt/hermes/.playwright | |
| # ------------------- ระบบพื้นฐาน ------------------- | |
| RUN apt-get update && \ | |
| apt-get install -y --no-install-recommends \ | |
| build-essential ca-certificates python3 ripgrep ffmpeg gcc python3-dev libffi-dev curl wget \ | |
| procps git git-lfs zip unzip tzdata python3 python3-venv python3-pip python3-setuptools python3-wheel && \ | |
| ln -fs /usr/share/zoneinfo/$TZ /etc/localtime && \ | |
| dpkg-reconfigure -f noninteractive tzdata && \ | |
| rm -rf /var/lib/apt/lists/* | |
| # ------------------- user ------------------- | |
| RUN useradd -u 10000 -m -d /opt/data hermes | |
| COPY --chmod=0755 --from=gosu_source /gosu /usr/local/bin/ | |
| COPY --chmod=0755 --from=uv_source /usr/local/bin/uv /usr/local/bin/uvx /usr/local/bin/ | |
| COPY . /tmp/hermes-space-overlay | |
| WORKDIR /opt | |
| ARG HERMES_WEB_UI_VERSION=latest | |
| ARG HERMES_AGENT_COMMIT # <-- optional build‑arg | |
| # ------------------- 1️⃣ ดึงคอมมิตล่าสุด / checkout ------------------- | |
| RUN set -eux; \ | |
| \ | |
| # ถ้าไม่ได้ส่งค่า build‑arg ให้ดึงคอมมิตล่าสุดจาก GitHub | |
| HERMES_AGENT_COMMIT="${HERMES_AGENT_COMMIT:-}"; \ | |
| if [ -z "${HERMES_AGENT_COMMIT}" ]; then \ | |
| echo "🔎 ดึงคอมมิตล่าสุดของสาขา main …"; \ | |
| HERMES_AGENT_COMMIT=$(git ls-remote https://github.com/NousResearch/hermes-agent.git refs/heads/main | cut -f1); \ | |
| echo "✅ คอมมิตล่าสุด = ${HERMES_AGENT_COMMIT}"; \ | |
| else \ | |
| echo "⚙️ ใช้คอมมิตที่ส่งมาจาก build‑arg = ${HERMES_AGENT_COMMIT}"; \ | |
| fi; \ | |
| \ | |
| # เขียน SHA‑1 ลงไฟล์ที่ขั้นตอนต่อไปจะอ่าน | |
| echo "${HERMES_AGENT_COMMIT}" > /tmp/hermes-space-overlay/docker/HERMES_UPSTREAM_REF; \ | |
| \ | |
| # Clone repo แล้ว checkout ตามค่าในไฟล์ HERMES_UPSTREAM_REF | |
| git clone --depth 1 https://github.com/NousResearch/hermes-agent.git /opt/hermes && \ | |
| cd /opt/hermes && \ | |
| git fetch --depth 1 origin "$(cat /tmp/hermes-space-overlay/docker/HERMES_UPSTREAM_REF)" && \ | |
| git checkout FETCH_HEAD && \ | |
| \ | |
| # คัดลอกไฟล์ overlay ที่จำเป็นลงในโฟลเดอร์ของ hermes‑agent | |
| install -D /tmp/hermes-space-overlay/docker/HERMES_UPSTREAM_REF /opt/hermes/docker/HERMES_UPSTREAM_REF && \ | |
| install -D /tmp/hermes-space-overlay/docker/entrypoint.sh /opt/hermes/docker/entrypoint.sh && \ | |
| install -D /tmp/hermes-space-overlay/docker/space_runtime.py /opt/hermes/docker/space_runtime.py && \ | |
| install -D /tmp/hermes-space-overlay/hermes_cli/hf_space_update.py /opt/hermes/hermes_cli/hf_space_update.py && \ | |
| install -D /tmp/hermes-space-overlay/hermes_cli/space_update_wrapper.py /opt/hermes/hermes_cli/space_update_wrapper.py && \ | |
| rm -rf /tmp/hermes-space-overlay | |
| WORKDIR /opt/hermes | |
| # ------------------- 2️⃣ Node / Playwright ------------------- | |
| RUN npm install --prefer-offline --no-audit && \ | |
| npm install -g --no-audit "hermes-web-ui@${HERMES_WEB_UI_VERSION}" && \ | |
| mkdir -p /usr/local/lib/node_modules/hermes-web-ui/dist/data && \ | |
| chown -R hermes:hermes /usr/local/lib/node_modules/hermes-web-ui && \ | |
| npx playwright install --with-deps chromium --only-shell && \ | |
| cd /opt/hermes/scripts/whatsapp-bridge && \ | |
| npm install --prefer-offline --no-audit && \ | |
| npm cache clean --force | |
| # ------------------- 3️⃣ ใช้ non‑root user ------------------- | |
| RUN chown -R hermes:hermes /opt/hermes | |
| USER hermes | |
| # ------------------- 4️⃣ Python virtualenv & deps ------------------- | |
| RUN uv venv && \ | |
| uv pip install --no-cache-dir -e ".[all]" "huggingface_hub[cli]" && \ | |
| mv /opt/hermes/.venv/bin/hermes /opt/hermes/.venv/bin/hermes-upstream && \ | |
| printf '%s\n' '#!/bin/sh' 'exec /opt/hermes/.venv/bin/python -m hermes_cli.space_update_wrapper "$@"' \ | |
| > /opt/hermes/.venv/bin/hermes && \ | |
| chmod +x /opt/hermes/.venv/bin/hermes | |
| ENV PATH="/opt/hermes/.venv/bin:${PATH}" | |
| # ------------------- 5️⃣ ทำให้ entrypoint executable ------------------- | |
| USER root | |
| RUN chmod +x /opt/hermes/docker/entrypoint.sh | |
| ENV HERMES_HOME=/opt/data | |
| VOLUME ["/opt/data"] | |
| ENTRYPOINT ["/opt/hermes/docker/entrypoint.sh"] | |