Creates ai/paperclip/ with: - Dockerfile: extends upstream paperclip image, pre-installs hermes-paperclip-adapter@0.3.0 npm package as seed data - docker-entrypoint.sh: seeds the adapter plugin on first boot if the persistent volume is empty, then runs original startup This ensures the Hermes adapter is available on first boot without requiring network access — no npm install needed at runtime. The adapter persists on the Docker volume across restarts.
36 lines
1.0 KiB
Bash
36 lines
1.0 KiB
Bash
#!/bin/sh
|
|
set -e
|
|
|
|
# ── Seed Hermes adapter if volume is fresh ──────────────────────────
|
|
PAPERCLIP_HOME="${PAPERCLIP_HOME:-/paperclip}"
|
|
if [ ! -f "${PAPERCLIP_HOME}/adapter-plugins.json" ]; then
|
|
echo "[paperclip] Seeding Hermes adapter plugin..."
|
|
cp -r /opt/paperclip-seed/* "${PAPERCLIP_HOME}/"
|
|
chown -R "${USER_UID:-1000}:${USER_GID:-1000}" \
|
|
"${PAPERCLIP_HOME}/adapter-plugins" \
|
|
"${PAPERCLIP_HOME}/adapter-plugins.json"
|
|
echo "[paperclip] Hermes adapter seeded. Ready to create Hermes agents."
|
|
fi
|
|
|
|
# ── Original entrypoint logic (UID/GID adjustment) ──────────────────
|
|
PUID="${USER_UID:-1000}"
|
|
PGID="${USER_GID:-1000}"
|
|
changed=0
|
|
|
|
if [ "$(id -u node)" -ne "$PUID" ]; then
|
|
usermod -o -u "$PUID" node
|
|
changed=1
|
|
fi
|
|
|
|
if [ "$(id -g node)" -ne "$PGID" ]; then
|
|
groupmod -o -g "$PGID" node
|
|
usermod -g "$PGID" node
|
|
changed=1
|
|
fi
|
|
|
|
if [ "$changed" = "1" ]; then
|
|
chown -R node:node "${PAPERCLIP_HOME}"
|
|
fi
|
|
|
|
exec gosu node "$@"
|