#!/bin/sh REPO_URL="${REPO_URL:-https://github.com/YOUR_USERNAME/YOUR_REPO.git}" BRANCH="${BRANCH:-main}" POLL_INTERVAL="${POLL_INTERVAL:-3600}" echo "Starting updater for $REPO_URL (branch: $BRANCH)" # Build initially cd /app npm install npm run build # Copy to shared volume cp -r /app/dist/* /dist/ echo "Initial build complete" # Poll for updates while true; do sleep "$POLL_INTERVAL" echo "Checking for updates..." git fetch origin "$BRANCH" LOCAL=$(git rev-parse HEAD) REMOTE=$(git rev-parse origin/"$BRANCH") if [ "$LOCAL" != "$REMOTE" ]; then echo "New changes detected! Rebuilding..." git pull origin "$BRANCH" npm run build cp -r /app/dist/* /dist/ echo "Done!" else echo "No changes" fi done