opencode/compose.yaml aktualisiert

This commit is contained in:
thomas committed 2026-12-05 21:32:09 +00:00
1 parent 7229af0899
commit 7a0f5a968f
1 file changed
+12 -4
+12 -4
View File
@@ -13,8 +13,9 @@ services:
- | - |
command -v git >/dev/null 2>&1 || /sbin/apk add --no-cache git curl ca-certificates command -v git >/dev/null 2>&1 || /sbin/apk add --no-cache git curl ca-certificates
# Background Git sync loop for /root/.config/opencode # Busy-safe background Git sync loop for /root/.config/opencode
( (
PENDING_RESTART=0
while true; do while true; do
sleep 60 sleep 60
if [ -d /root/.config/opencode/.git ]; then if [ -d /root/.config/opencode/.git ]; then
@@ -24,13 +25,20 @@ services:
REMOTE=$$(git rev-parse origin/main 2>/dev/null) REMOTE=$$(git rev-parse origin/main 2>/dev/null)
if [ -n "$$REMOTE" ] && [ "$$LOCAL" != "$$REMOTE" ]; then if [ -n "$$REMOTE" ] && [ "$$LOCAL" != "$$REMOTE" ]; then
CHANGED=$$(git diff --name-only "$$LOCAL" "$$REMOTE") CHANGED=$$(git diff --name-only "$$LOCAL" "$$REMOTE")
git pull --ff-only origin main -q if git pull --ff-only origin main -q; then
# Restart container only if opencode.jsonc changed
if echo "$$CHANGED" | grep -q "opencode.jsonc"; then if echo "$$CHANGED" | grep -q "opencode.jsonc"; then
kill 1 PENDING_RESTART=1
fi fi
fi fi
fi fi
fi
if [ "$$PENDING_RESTART" -eq 1 ]; then
STATUS=$$(curl -s -m 5 -u "$$OPENCODE_SERVER_USERNAME:$$OPENCODE_SERVER_PASSWORD" http://127.0.0 2>/dev/null)
if [ -n "$$STATUS" ] && ! echo "$$STATUS" | grep -qE '"(busy|running|retry)"'; then
kill 1
fi
fi
done done
) & ) &