Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .github/workflows/build-docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,18 @@
source ./tool.sh
build_image openclaw latest docker_openclaw/openclaw.Dockerfile && push_image openclaw

## Hermes Agent
job-hermes:
name: "hermes"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- run: |
source ./tool.sh
build_image hermes latest docker_hermes/hermes.Dockerfile && push_image hermes

## DevBox - base
job-base-dev:

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}
name: "developer,base-dev"
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -217,6 +227,7 @@
"job-base-dev",
"job-nocobase",
"job-openclaw",
"job-hermes",
"job-logent",
"job-storebox",
"job-searxng",
Expand Down
4 changes: 0 additions & 4 deletions docker_devbox/dev.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,6 @@ RUN set -eux && source /opt/utils/script-utils.sh \
## ----------------------------- If installing R IDEs: R_rstudio and R_rshiny
&& source /opt/utils/script-devbox-rstudio.sh \
&& for profile in $(echo $ARG_PROFILE_R | tr "," "\n") ; do ( setup_R_${profile} ) ; done \
## ----------------------------- Install supervisord
&& source /opt/utils/script-setup-sys.sh && setup_supervisord \
## ----------------------------- Install caddy
&& source /opt/utils/script-setup-net.sh && setup_caddy 2.11.2 \
## Clean up and display components version information...
&& list_installed_packages && install__clean

Expand Down
6 changes: 0 additions & 6 deletions docker_devbox/work/start-supervisord.sh

This file was deleted.

9 changes: 5 additions & 4 deletions docker_gui/gui_linux.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ RUN set -eux && chmod +x /opt/utils/*.sh \
fi \
&& mv /opt/utils/docker-entrypoint.sh /opt/selkies/docker-entrypoint.sh \
&& mv /opt/utils/install_list_selkies.apt /opt/selkies/ \
&& chmod +x /opt/selkies/docker-entrypoint.sh
&& chmod +x /opt/selkies/docker-entrypoint.sh \
## Build pixelflux wheel into /opt/selkies
&& apt install -y build-essential cmake pkg-config libx11-dev libxext-dev libxfixes-dev libjpeg-dev libx264-dev libyuv-dev libavcodec-dev libavutil-dev libva-dev \
&& cd / && pip wheel --no-cache-dir --no-binary :all: pixelflux -w /opt/selkies


# Stage 2: runtime image
Expand All @@ -40,9 +43,6 @@ COPY --from=builder /opt/selkies /opt/selkies
RUN set -eux && cd /opt/selkies \
&& source /opt/utils/script-utils.sh \
&& install_apt /opt/selkies/install_list_selkies.apt \
&& apt install -y build-essential cmake pkg-config libx11-dev libxext-dev libxfixes-dev libjpeg-dev libx264-dev libyuv-dev libavcodec-dev libavutil-dev libva-dev \
&& pip install --no-cache-dir --no-binary :all: pixelflux \
&& apt purge -y build-essential cmake pkg-config libx11-dev libxext-dev libxfixes-dev libjpeg-dev libx264-dev libyuv-dev libavcodec-dev libavutil-dev libva-dev \
&& pip install --no-cache-dir ./*.whl \
&& if [ -f /opt/selkies/lib/selkies_joystick_interposer.so ]; then \
ln -sf /opt/selkies/lib/selkies_joystick_interposer.so /usr/lib/selkies_joystick_interposer.so ; \
Expand All @@ -52,6 +52,7 @@ RUN set -eux && cd /opt/selkies \
&& ln -sf /opt/selkies/lib/libudev.so.1.0.0-fake /usr/lib/libudev.so.1 \
&& ln -sf /opt/selkies/lib/libudev.so.1.0.0-fake /usr/lib/libudev.so ; \
fi \
&& rm -f /opt/selkies/*.whl \
&& list_installed_packages && install__clean

ENV PATH=/opt/selkies:/opt/conda/bin:${PATH}
Expand Down
61 changes: 61 additions & 0 deletions docker_hermes/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Hermes Agent Docker Image

This directory contains the Dockerfile for building the [Hermes Agent](https://github.com/nousresearch/hermes-agent) Docker image.

## Optimization Features

- **Multi-stage Build**: Significantly reduces image size by separating the build environment from the runtime environment.
- **Persistent Storage**: All user data, configurations, and logs are stored in `/root/workspace`.
- **Runtime Environment**: Uses the base Python environment instead of a virtual environment for simplicity and efficiency.

## Quick Start

### Build Image

```bash
docker build -f hermes.Dockerfile -t hermes-agent:latest .
```

### Run with Docker Compose

```bash
cd demo
docker compose up -d
```

### Run Manually

```bash
# Run with persistent volume
docker run -d \
--name hermes \
--hostname hermes \
-p 8000:8000 \
-v /path/to/your/data:/root/workspace \
hermes-agent:latest
```

## Environment Variables

| Variable | Default | Description |
|----------|---------|-------------|
| HERMES_HOME | `/root/workspace` | Home directory for hermes data |
| HOME | `/root/workspace` | System HOME environment variable |
| PLAYWRIGHT_BROWSERS_PATH | `/opt/hermes/.playwright` | Path for Playwright browsers |

## Volumes

- `/root/workspace` - Persistent data directory for hermes configuration, memories, and skills. This should be mapped to a host directory for data persistence.

## Build Arguments

| Argument | Default | Description |
|----------|---------|-------------|
| BASE_NAMESPACE | (empty) | Namespace for the base image |
| BASE_IMG | `node` | Base image name (expected to have Node and Python) |

## Documentation

For more information about Hermes Agent, see:
- [Official Documentation](https://hermes-agent.nousresearch.com/docs/)
- [GitHub Repository](https://github.com/nousresearch/hermes-agent)
16 changes: 16 additions & 0 deletions docker_hermes/demo/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
name: "svc-hermes"

services:
hermes:
container_name: svc-hermes
hostname: svc-hermes
image: "quay.io/labnow/hermes:latest"
pull_policy: if_not_present
restart: unless-stopped
network_mode: host
environment:
- TZ=Asia/Shanghai
- HERMES_DASHBOARD=true # Set to true to start the dashboard alongside the gateway
volumes:
- /data/hermes:/opt/data

66 changes: 66 additions & 0 deletions docker_hermes/hermes.Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Distributed under the terms of the Modified BSD License.

ARG BASE_NAMESPACE
ARG BASE_IMG="node"

# --- Building Stage ---
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG} AS builder

LABEL maintainer="postmaster@labnow.ai"

# Build-time environment
ENV NODE_ENV=development
WORKDIR /build

# Clone source
RUN git clone --depth 1 --branch main https://github.com/nousresearch/hermes-agent.git .

# Install Node dependencies and build frontend
RUN set -eux \
&& export npm_config_install_links=false \
&& npm install --include=dev --prefer-offline --no-audit \
&& (cd web && npm run build) \
&& (cd ui-tui && npm run build) \
&& mkdir -p hermes_cli/tui_dist && cp ui-tui/dist/entry.js hermes_cli/tui_dist/

# Build Python wheel
RUN set -eux \
&& python3 -m pip install --upgrade pip build \
&& python3 -m build --wheel --outdir dist

# --- Runtime Stage ---
FROM ${BASE_NAMESPACE:+$BASE_NAMESPACE/}${BASE_IMG}

LABEL maintainer="postmaster@labnow.ai"

# Production environment
ENV NODE_ENV=production
ENV HERMES_HOME=/root/workspace
ENV HERMES_WEB_DIST=/usr/local/lib/python3.12/dist-packages/hermes_cli/web_dist
ENV HERMES_TUI_DIR=/usr/local/lib/python3.12/dist-packages/hermes_cli/tui_dist
ENV PATH="/opt/node/bin:/opt/conda/bin:/root/.local/bin:${PATH}"
ENV HOME=/root/workspace
WORKDIR /root/workspace
ENV PLAYWRIGHT_BROWSERS_PATH=/opt/hermes/.playwright

# Copy utilities and tools
COPY work /opt/utils/
RUN chmod +x /opt/utils/*.sh && cp /opt/utils/start-hermes.sh /usr/local/bin/start-hermes.sh

# Copy build artifacts from builder
COPY --from=builder /build/dist/*.whl /tmp/

# Install Runtime dependencies
RUN set -eux \
&& pip install --no-cache-dir /tmp/*.whl \
&& npx playwright install --with-deps chromium --only-shell \
## Install supervisord (Go version)
&& source /opt/utils/script-setup-sys.sh && setup_supervisord \
&& source /opt/utils/script-utils.sh && install_apt /opt/utils/install_list_hermes.apt \
&& install__clean \
&& rm -rf /tmp/*.whl

# Data persistence
VOLUME /root/workspace

CMD ["start-hermes.sh"]
9 changes: 9 additions & 0 deletions docker_hermes/work/install_list_hermes.apt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
iputils-ping
ripgrep
ffmpeg
libffi-dev
libolm-dev
procps
openssh-client
docker-cli
xz-utils
73 changes: 73 additions & 0 deletions docker_hermes/work/start-hermes.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
#!/usr/bin/env bash
set -eu

# Setup data directory
HERMES_HOME="${HERMES_HOME:-/root/workspace}"
mkdir -p "$HERMES_HOME"

for sub in cron sessions logs hooks memories skills skins plans workspace home pairing platforms/pairing logs/gateways; do
mkdir -p "$HERMES_HOME/$sub"
done

# Seed initial config files
seed_one() {
local dest=$1
local src=$2
if [ ! -f "$HERMES_HOME/$dest" ] && [ -f "/opt/hermes/$src" ]; then
cp "/opt/hermes/$src" "$HERMES_HOME/$dest"
fi
}
seed_one ".env" ".env.example"
seed_one "config.yaml" "cli-config.yaml.example"
seed_one "SOUL.md" "docker/SOUL.md"

if [ -f "$HERMES_HOME/.env" ]; then
chmod 600 "$HERMES_HOME/.env" 2>/dev/null || true
fi

# Run schema migration
if [ -f "$HERMES_HOME/config.yaml" ]; then
python3 -m scripts.docker_config_migrate || true
fi

# Seed bootstrap auth.json and gateway_state.json
if [ ! -f "$HERMES_HOME/auth.json" ] && [ -n "${HERMES_AUTH_JSON_BOOTSTRAP:-}" ]; then
printf '%s' "$HERMES_AUTH_JSON_BOOTSTRAP" > "$HERMES_HOME/auth.json"
chmod 600 "$HERMES_HOME/auth.json"
fi
if [ ! -f "$HERMES_HOME/gateway_state.json" ] && [ "${HERMES_GATEWAY_BOOTSTRAP_STATE:-}" = "running" ]; then
printf '{"gateway_state":"running"}\n' > "$HERMES_HOME/gateway_state.json"
chmod 644 "$HERMES_HOME/gateway_state.json"
fi

# Sync bundled skills
if [ -d "/opt/hermes/skills" ]; then
python3 -m tools.skills_sync || true
fi

# Find agent-browser Playwright binary and set env
if [ -z "${AGENT_BROWSER_EXECUTABLE_PATH:-}" ] && [ -n "${PLAYWRIGHT_BROWSERS_PATH:-}" ] && [ -d "$PLAYWRIGHT_BROWSERS_PATH" ]; then
browser_bin=$(find "$PLAYWRIGHT_BROWSERS_PATH" -type f -executable \( -name 'chrome' -o -name 'chromium' -o -name 'chrome-headless-shell' -o -name 'headless_shell' -o -name 'chromium-browser' \) 2>/dev/null | head -n 1)
if [ -n "$browser_bin" ]; then
export AGENT_BROWSER_EXECUTABLE_PATH="$browser_bin"
echo "[start-hermes] Set AGENT_BROWSER_EXECUTABLE_PATH=$browser_bin"
fi
fi

# Configure environments for command invocation
export HOME=/root/workspace
cd /root/workspace

# If arguments are passed, route them
if [ $# -gt 0 ]; then
# If the first argument is an executable in PATH, execute it directly (e.g. bash, sh, sleep)
if command -v "$1" >/dev/null 2>&1; then
exec "$@"
else
# Otherwise, pass to hermes CLI
exec hermes "$@"
fi
fi

# No arguments: start supervisord to run both gateway and dashboard (if requested)
exec /opt/utils/supervisord.sh
49 changes: 49 additions & 0 deletions docker_hermes/work/supervisord.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# Generate /etc/supervisord.conf dynamically and run supervisord
set -eu

# Set up dashboard parameters
dash_host="${HERMES_DASHBOARD_HOST:-0.0.0.0}"
dash_port="${HERMES_DASHBOARD_PORT:-9119}"

insecure=""
case "${HERMES_DASHBOARD_INSECURE:-}" in
1|true|TRUE|True|yes|YES|Yes) insecure="--insecure" ;;
esac

dashboard_autostart="false"
case "${HERMES_DASHBOARD:-}" in
1|true|TRUE|True|yes|YES|Yes) dashboard_autostart="true" ;;
esac

# Generate /etc/supervisord.conf
cat <<EOF > /etc/supervisord.conf
[supervisord]
nodaemon=true
user=root
logfile=/var/log/supervisord.log
pidfile=/var/run/supervisord.pid

[program:gateway]
command=exec hermes gateway run --replace
directory=/opt/data
autostart=true
autorestart=true
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0

[program:dashboard]
command=exec hermes dashboard --host ${dash_host} --port ${dash_port} --no-open ${insecure}
directory=/opt/data
autostart=${dashboard_autostart}
autorestart=true
stdout_logfile=/dev/stdout
stderr_logfile=/dev/stderr
stdout_logfile_maxbytes=0
stderr_logfile_maxbytes=0
EOF

echo "[start-hermes] Starting supervisord..."
exec supervisord -c /etc/supervisord.conf
Loading