diff --git a/Dockerfile b/Dockerfile index b88a1b1..1bba8e2 100644 --- a/Dockerfile +++ b/Dockerfile @@ -29,5 +29,5 @@ EXPOSE 3000 8080 8081 7681 HEALTHCHECK --interval=30s --timeout=10s --start-period=120s --retries=3 \ CMD curl -f http://localhost:3000/health || exit 1 -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] +ENTRYPOINT ["/init", "/usr/local/bin/entrypoint.sh"] CMD ["gateway", "run"] diff --git a/entrypoint.sh b/entrypoint.sh index 0f0bc33..b21d3f4 100644 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/command/with-contenv bash # DAppNode Hermes Agent entrypoint # Based on upstream docker/entrypoint.sh (v2026.5.7) with DAppNode additions. set -e @@ -86,14 +86,6 @@ if [ "$(id -u)" = "0" ]; then drop_to_hermes "$@" fi -# If this script is PID 1 after the privilege drop, insert tini while still -# running as `hermes`. That keeps signal forwarding/zombie reaping without -# making the setup wizard signal a root-owned PID 1 on restart. -if [ "${DAPPNODE_TINI_WRAPPED:-}" != "1" ] && [ "$$" = "1" ] && command -v tini >/dev/null 2>&1; then - export DAPPNODE_TINI_WRAPPED=1 - exec tini -g -- "$0" "$@" -fi - # --- Running as hermes from here --- export HOME="$HERMES_HOME/home" export USER="${USER:-hermes}" @@ -108,14 +100,13 @@ rm -f "$HERMES_HOME"/gateway.lock "$HERMES_HOME"/gateway.pid # --- Bootstrap config files (mirrors upstream entrypoint) --- mkdir -p "$HERMES_HOME"/{cron,sessions,logs,hooks,memories,skills,skins,plans,workspace,home} -if [ ! -f "$HERMES_HOME/.env" ]; then +if [ ! -f "$HERMES_HOME/.env" ] && [ -f "$INSTALL_DIR/.env.example" ]; then cp "$INSTALL_DIR/.env.example" "$HERMES_HOME/.env" fi -if [ ! -f "$HERMES_HOME/config.yaml" ]; then +if [ ! -f "$HERMES_HOME/config.yaml" ] && [ -f "$INSTALL_DIR/cli-config.yaml.example" ]; then cp "$INSTALL_DIR/cli-config.yaml.example" "$HERMES_HOME/config.yaml" fi - -if [ ! -f "$HERMES_HOME/SOUL.md" ]; then +if [ ! -f "$HERMES_HOME/SOUL.md" ] && [ -f "$INSTALL_DIR/docker/SOUL.md" ]; then cp "$INSTALL_DIR/docker/SOUL.md" "$HERMES_HOME/SOUL.md" fi