#!/bin/sh # Build, push to the self-hosted registry, and trigger Watchtower. # # Run this ON THE VPS (registry is bound to 127.0.0.1, so it's only # reachable locally). To run it from your laptop instead, first open a # tunnel: ssh -L 5000:localhost:5000 -L 8080:localhost:8080 user@vps set -e IMAGE=localhost:5000/bankline:latest WATCHTOWER_URL=http://localhost:8080/v1/update SCRIPT_DIR=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd) docker build -t "$IMAGE" -f "$SCRIPT_DIR/Dockerfile" "$SCRIPT_DIR" docker push "$IMAGE" if [ -z "$WATCHTOWER_TOKEN" ]; then echo "WATCHTOWER_TOKEN not set — skipping trigger; Watchtower will pick it up on its next poll." >&2 exit 0 fi curl -sf -H "Authorization: Bearer $WATCHTOWER_TOKEN" "$WATCHTOWER_URL" echo "Watchtower update triggered."