Spaces:
Running
Running
Z User commited on
Commit ·
6ffc130
1
Parent(s): c310c5b
fix: correct CLI import (cli->main), add start.sh for persistent symlinks
Browse files- Dockerfile +7 -13
- entry.py +2 -2
- start.sh +20 -0
Dockerfile
CHANGED
|
@@ -5,9 +5,6 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 5 |
git curl gnupg2 \
|
| 6 |
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
|
| 8 |
-
# Create persistent data directories
|
| 9 |
-
RUN mkdir -p /data/hermes/{sessions,memories,uploads,logs,palace,skills}
|
| 10 |
-
|
| 11 |
WORKDIR /app
|
| 12 |
|
| 13 |
# Clone hermes-agent
|
|
@@ -19,14 +16,8 @@ ENV PATH="/app/venv/bin:$PATH"
|
|
| 19 |
RUN pip install --quiet --upgrade pip && \
|
| 20 |
pip install --quiet -e "/app/hermes-agent[feishu,mcp,cron,pty]" 2>&1 | tail -5
|
| 21 |
|
| 22 |
-
# Create hermes home
|
| 23 |
-
RUN mkdir -p /root/.hermes
|
| 24 |
-
ln -sf /data/hermes/sessions /root/.hermes/sessions && \
|
| 25 |
-
ln -sf /data/hermes/memories /root/.hermes/memories && \
|
| 26 |
-
ln -sf /data/hermes/uploads /root/.hermes/uploads && \
|
| 27 |
-
ln -sf /data/hermes/logs /root/.hermes/logs && \
|
| 28 |
-
ln -sf /data/hermes/palace /root/.hermes/palace && \
|
| 29 |
-
ln -sf /data/hermes/skills /root/.hermes/skills
|
| 30 |
|
| 31 |
# Copy config files
|
| 32 |
COPY config.yaml /root/.hermes/config.yaml
|
|
@@ -36,10 +27,13 @@ COPY entry.py /app/entry.py
|
|
| 36 |
|
| 37 |
RUN chmod 600 /root/.hermes/.env
|
| 38 |
|
| 39 |
-
#
|
|
|
|
|
|
|
|
|
|
| 40 |
EXPOSE 7860
|
| 41 |
|
| 42 |
ENV HERMES_ACCEPT_HOOKS=1
|
| 43 |
ENV MEMPALACE_PALACE_PATH=/data/hermes/palace
|
| 44 |
|
| 45 |
-
CMD ["
|
|
|
|
| 5 |
git curl gnupg2 \
|
| 6 |
&& rm -rf /var/lib/apt/lists/*
|
| 7 |
|
|
|
|
|
|
|
|
|
|
| 8 |
WORKDIR /app
|
| 9 |
|
| 10 |
# Clone hermes-agent
|
|
|
|
| 16 |
RUN pip install --quiet --upgrade pip && \
|
| 17 |
pip install --quiet -e "/app/hermes-agent[feishu,mcp,cron,pty]" 2>&1 | tail -5
|
| 18 |
|
| 19 |
+
# Create hermes home
|
| 20 |
+
RUN mkdir -p /root/.hermes
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 21 |
|
| 22 |
# Copy config files
|
| 23 |
COPY config.yaml /root/.hermes/config.yaml
|
|
|
|
| 27 |
|
| 28 |
RUN chmod 600 /root/.hermes/.env
|
| 29 |
|
| 30 |
+
# Startup script: ensure persistent dirs exist, create symlinks, then run entry
|
| 31 |
+
COPY start.sh /app/start.sh
|
| 32 |
+
RUN chmod +x /app/start.sh
|
| 33 |
+
|
| 34 |
EXPOSE 7860
|
| 35 |
|
| 36 |
ENV HERMES_ACCEPT_HOOKS=1
|
| 37 |
ENV MEMPALACE_PALACE_PATH=/data/hermes/palace
|
| 38 |
|
| 39 |
+
CMD ["/app/start.sh"]
|
entry.py
CHANGED
|
@@ -93,13 +93,13 @@ def main():
|
|
| 93 |
health_thread.start()
|
| 94 |
|
| 95 |
# Launch Hermes Gateway
|
| 96 |
-
from hermes_cli.main import
|
| 97 |
logger.info("Launching Hermes Gateway...")
|
| 98 |
|
| 99 |
# The gateway blocks, so we run it in the main thread
|
| 100 |
try:
|
| 101 |
sys.argv = ["hermes", "gateway", "run", "-v"]
|
| 102 |
-
|
| 103 |
except KeyboardInterrupt:
|
| 104 |
logger.info("Shutting down...")
|
| 105 |
except SystemExit as e:
|
|
|
|
| 93 |
health_thread.start()
|
| 94 |
|
| 95 |
# Launch Hermes Gateway
|
| 96 |
+
from hermes_cli.main import main as hermes_main
|
| 97 |
logger.info("Launching Hermes Gateway...")
|
| 98 |
|
| 99 |
# The gateway blocks, so we run it in the main thread
|
| 100 |
try:
|
| 101 |
sys.argv = ["hermes", "gateway", "run", "-v"]
|
| 102 |
+
hermes_main()
|
| 103 |
except KeyboardInterrupt:
|
| 104 |
logger.info("Shutting down...")
|
| 105 |
except SystemExit as e:
|
start.sh
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/bin/bash
|
| 2 |
+
set -e
|
| 3 |
+
|
| 4 |
+
# Ensure persistent storage directories exist
|
| 5 |
+
mkdir -p /data/hermes/{sessions,memories,uploads,logs,palace,skills}
|
| 6 |
+
|
| 7 |
+
# Create symlinks from hermes home to persistent storage
|
| 8 |
+
HERMES_HOME="/root/.hermes"
|
| 9 |
+
for dir in sessions memories uploads logs palace skills; do
|
| 10 |
+
target="$HERMES_HOME/$dir"
|
| 11 |
+
if [ ! -L "$target" ] && [ ! -d "$target" ]; then
|
| 12 |
+
ln -sf "/data/hermes/$dir" "$target"
|
| 13 |
+
echo "Created symlink: $dir -> /data/hermes/$dir"
|
| 14 |
+
elif [ -L "$target" ]; then
|
| 15 |
+
echo "Symlink exists: $dir"
|
| 16 |
+
fi
|
| 17 |
+
done
|
| 18 |
+
|
| 19 |
+
echo "Persistent storage ready."
|
| 20 |
+
exec python3 /app/entry.py
|