Hostityourself/infra/runner-entrypoint.sh
Claude 4ac5700ac5
fix: add runner-entrypoint.sh to register Forgejo runner on first start
The data.forgejo.org/forgejo/runner image doesn't auto-register from
env vars — it needs create-runner-file called explicitly before the
daemon starts. The entrypoint handles registration on first run (no
/data/.runner file) then execs the daemon on all subsequent starts.

https://claude.ai/code/session_01FKCW3FDjNFj6jve4niMFXH
2026-03-27 14:41:45 +00:00

22 lines
767 B
Bash
Executable file

#!/bin/sh
# runner-entrypoint.sh — register the Forgejo runner on first start, then run the daemon.
#
# On first run (no /data/.runner file) it calls create-runner-file to register
# with the Forgejo instance using FORGEJO_RUNNER_TOKEN. On subsequent starts it
# goes straight to the daemon.
set -e
CONFIG=/data/.runner
if [ ! -f "$CONFIG" ]; then
echo "[runner] No registration found — registering with Forgejo…"
forgejo-runner create-runner-file \
--instance "${FORGEJO_INSTANCE_URL}" \
--secret "${FORGEJO_RUNNER_TOKEN}" \
--name "${FORGEJO_RUNNER_NAME:-hiy-runner}" \
--connect
echo "[runner] Registration complete."
fi
echo "[runner] Starting daemon…"
exec forgejo-runner daemon --config "$CONFIG"