File size: 3,734 Bytes
5dfb831 ed7e91a 5dfb831 c5ea2d1 5dfb831 9c173b7 5dfb831 c5ea2d1 5dfb831 c5ea2d1 5dfb831 5ea1a6e 5dfb831 fe65b9c 2af4a3a 5dfb831 2af4a3a 5dfb831 64de9c5 c5ea2d1 5dfb831 b230c19 5dfb831 ed7e91a 98b03e6 2af4a3a c5ea2d1 5dfb831 3cfbcfa 5dfb831 be3a29e 5dfb831 ed7e91a 5dfb831 e0c372b 5dfb831 ed7e91a c5ea2d1 5dfb831 ab64be7 5dfb831 c5ea2d1 5dfb831 9c173b7 5dfb831 9c173b7 5dfb831 c5ea2d1 64de9c5 2af4a3a 5dfb831 c5ea2d1 | 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 103 104 105 106 107 | FROM python:3.11-slim
LABEL maintainer="Hermes Agent Community"
LABEL version="0.10.0"
LABEL description="Hermes Agent v0.10.0 with Web UI on Hugging Face Spaces"
# ==================== Environment Variables ====================
ENV PYTHONUNBUFFERED=1
ENV DEBIAN_FRONTEND=noninteractive
ENV HERMES_HOME=/data/.hermes
ENV HERMES_WEB_UI_HOME=/data/.hermes-web-ui
ENV PYTHONPATH=/app
# BFF Server Environment Variables (Build Stage)
ENV PORT=7860
ENV UPSTREAM=http://127.0.0.1:8642
ENV HERMES_BIN=/usr/local/bin/hermes
# ==================== System Dependencies ====================
RUN apt-get update && apt-get install -y \
make gcc g++ \
ffmpeg \
git \
curl \
unzip \
ca-certificates \
&& rm -rf /var/lib/apt/lists/*
# ==================== Node.js v24 ====================
RUN ARCH=$(dpkg --print-architecture) \
&& if [ "$ARCH" = "amd64" ]; then NODE_ARCH="x64"; else NODE_ARCH="$ARCH"; fi \
&& echo "Installing Node.js v24.21.0 for ${NODE_ARCH}" \
&& curl -fsSL "https://nodejs.org/dist/v24.21.0/node-v24.21.0-linux-${NODE_ARCH}.tar.gz" \
-o /tmp/node.tar.gz \
&& tar -xzf /tmp/node.tar.gz -C /usr/local --strip-components=1 \
&& rm -f /tmp/node.tar.gz \
&& node --version \
&& npm --version
# ==================== CLI Tools ====================
RUN curl -sL https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 -o /usr/bin/yq && \
chmod +x /usr/bin/yq
# ==================== Code Server ====================
RUN curl -fsSL https://code-server.dev/install.sh | sh
# ==================== Caddy Server====================
RUN curl -fsSL "https://caddyserver.com/api/download?os=linux&arch=amd64" -o /usr/local/bin/caddy && \
chmod +x /usr/local/bin/caddy
# ==================== REA Code ====================
RUN npm install -g rea-agents@latest \
&& rea --version \
&& rm -rf /root/.npm
# ==================== Python Dependencies ====================
COPY requirements.txt /tmp/
RUN pip install --no-cache-dir --prefer-binary -r /tmp/requirements.txt
# ==================== Hermes Agent ====================
RUN git clone --depth 1 https://github.com/NousResearch/hermes-agent.git /usr/local/lib/hermes-agent && \
pip install uv && \
cd /usr/local/lib/hermes-agent && \
uv pip install --system -e ".[all,anthropic]" && \
rm -rf /root/.cache/pip
# ==================== Hermes Web UI ====================
ARG HERMES_WEB_UI_VERSION=latest
RUN mkdir -p /opt/hermes-web-ui && cd /opt/hermes-web-ui && \
npm init -y && \
npm install hermes-web-ui@${HERMES_WEB_UI_VERSION} && \
ln -sf node_modules/hermes-web-ui/dist dist && \
ln -sf node_modules/hermes-web-ui/package.json package.json && \
rm -rf /root/.npm
# ==================== Application Code ====================
WORKDIR /app
COPY src/ /app/src/
COPY entrypoint.sh /app/
COPY config/ /app/config/
COPY config/config.yaml /data/.hermes/config.yaml
# Create data directories
RUN mkdir -p /data/.hermes /data/.hermes-web-ui /app/logs && \
chmod +x /app/entrypoint.sh
# Configure non-root user
RUN useradd -m -u 1000 appuser && \
ln -sf /data/.hermes /home/appuser/.hermes && \
ln -sf /data/.hermes-web-ui /home/appuser/.hermes-web-ui && \
chown -R appuser:appuser /data /opt/hermes-web-ui /app
USER appuser
# ==================== Runtime Environment Variables ====================
ENV NODE_ENV=production
# prewarm npx cache as appuser (after useradd / USER appuser)
RUN npx -y rea-agents@6.4.0 mcp --help >/dev/null 2>&1 || true
EXPOSE 7860 8443
HEALTHCHECK --interval=30s --timeout=10s --start-period=90s --retries=3 \
CMD curl -f http://localhost:7860/health || exit 1
ENTRYPOINT ["/app/entrypoint.sh"]
|