#!/bin/bash # Build and push the podsteadr and podsteadr-player images to the registry the # manifests pull from. # Usage: ./push-to-registry.sh [version] # # Environment variables: # REGISTRY - Registry host (default: source.archipelago-foundation.org, same as indeedhub/botfights) # NAMESPACE - Registry namespace (default: lfg2025) # RUNTIME - Container runtime (default: podman) # PODSTEADR_REPO - podsteadr repo (default: ~/podsteadr) # PLAYER_REPO - podsteadr-player repo (default: ~/podsteadr-player) set -e SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO_DIR="${PODSTEADR_REPO:-$HOME/podsteadr}" PLAYER_DIR="${PLAYER_REPO:-$HOME/podsteadr-player}" VERSION="${1:-1.0.0}" REGISTRY="${REGISTRY:-source.archipelago-foundation.org}" NAMESPACE="${NAMESPACE:-lfg2025}" RUNTIME="${RUNTIME:-podman}" APP_TAG="${REGISTRY}/${NAMESPACE}/podsteadr:${VERSION}" PLAYER_TAG="${REGISTRY}/${NAMESPACE}/podsteadr-player:${VERSION}" if [ ! -d "$REPO_DIR" ]; then echo "podsteadr repo not found at: $REPO_DIR" echo "Set PODSTEADR_REPO=/path/to/podsteadr" exit 1 fi if [ ! -d "$PLAYER_DIR" ]; then echo "podsteadr-player repo not found at: $PLAYER_DIR" echo "Set PLAYER_REPO=/path/to/podsteadr-player" exit 1 fi # On Archipelago hosts rootless podman stages builds and pulls in /var/tmp, # which it sees read-only (its namespace comes from the sandboxed archipelago # service, so a writability test from this shell can't detect it). Stage in # the home directory instead unless TMPDIR is already set. if [ "$RUNTIME" = "podman" ] && [ -z "${TMPDIR:-}" ]; then export TMPDIR="$HOME/.cache/podman-build-tmp" mkdir -p "$TMPDIR" fi # Build, then tag by image id. `build -t` re-tags a fully cached image by # copying it through a temp dir that ignores TMPDIR (/var/tmp, read-only on # Archipelago hosts), so re-running a build fails; `tag` is metadata-only. build_and_tag() { local tag="$1"; shift local iidfile iidfile="$(mktemp)" $RUNTIME build --iidfile "$iidfile" "$@" $RUNTIME tag "$(cat "$iidfile")" "$tag" rm -f "$iidfile" } echo "=== podsteadr Container Registry Push ===" echo "Sources: $REPO_DIR, $PLAYER_DIR" echo "Images: $APP_TAG" echo " $PLAYER_TAG" echo "Runtime: $RUNTIME" echo "" echo "[1/3] Building images..." build_and_tag "$APP_TAG" --platform linux/amd64 -f "$SCRIPT_DIR/Dockerfile" "$REPO_DIR" build_and_tag "$PLAYER_TAG" --platform linux/amd64 "$PLAYER_DIR" echo "[2/3] Pushing to registry..." if ! $RUNTIME login --get-login "$REGISTRY" >/dev/null 2>&1; then echo "" echo "Not logged in to $REGISTRY." echo "Run: $RUNTIME login $REGISTRY" exit 1 fi $RUNTIME push "$APP_TAG" $RUNTIME push "$PLAYER_TAG" echo "" echo "[3/3] Done!" echo "" echo "Images pushed:" echo " $APP_TAG" echo " $PLAYER_TAG" echo "" echo "If you pushed a new version, bump container.image in apps/podsteadr/manifest.yml" echo "and apps/podsteadr-player/manifest.yml to match."