From 26a830c39f7ea8b8d3f611ba825feb9882b07e31 Mon Sep 17 00:00:00 2001 From: agentbox Date: Fri, 31 Jul 2026 22:45:56 +0000 Subject: [PATCH] fix: launch docker compose on first run too --- watch-for-updates.sh | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/watch-for-updates.sh b/watch-for-updates.sh index a602d8c..d40bc5f 100755 --- a/watch-for-updates.sh +++ b/watch-for-updates.sh @@ -47,27 +47,30 @@ while true; do echo "[$(date -Iseconds)] New commits detected! Updating..." echo " Previous: $LAST_HASH" echo " Current: $REMOTE_HASH" - git pull origin main 2>&1 || { echo "[$(date -Iseconds)] ERROR: git pull failed, retrying in 20s..." LAST_HASH="" sleep 20 continue } - echo "[$(date -Iseconds)] Bringing containers down..." docker compose -f "$COMPOSE_FILE" down 2>&1 - - echo "[$(date -Iseconds)] Building images..." - docker compose -f "$COMPOSE_FILE" build 2>&1 - - echo "[$(date -Iseconds)] Starting containers..." - docker compose -f "$COMPOSE_FILE" up -d 2>&1 - - echo "[$(date -Iseconds)] Update complete." else - echo "[$(date -Iseconds)] Initial state recorded: $REMOTE_HASH" + echo "[$(date -Iseconds)] First run — pulling and launching containers..." + git pull origin main 2>&1 || { + echo "[$(date -Iseconds)] ERROR: git pull failed, retrying in 20s..." + sleep 20 + continue + } fi + + echo "[$(date -Iseconds)] Building images..." + docker compose -f "$COMPOSE_FILE" build 2>&1 + + echo "[$(date -Iseconds)] Starting containers..." + docker compose -f "$COMPOSE_FILE" up -d 2>&1 + + echo "[$(date -Iseconds)] Update complete." LAST_HASH="$REMOTE_HASH" else echo "[$(date -Iseconds)] No changes."