#!/usr/bin/env bash # Build NATIVE linux/arm64 agent images for Apple-silicon Mac fleet nodes (whose # Colima/Docker VM is arm64 — the amd64 images from scripts/deploy.sh otherwise run # under Rosetta). Run this on an arm64 mac so the build is native (no QEMU). # # The amd64 images (scripts/deploy.sh) still cover the Linux nodes + Intel Macs. # These :dev arm64 images carry the same tag and are loaded ONLY onto the arm64 Mac # node(s) below, so each host holds its arch-appropriate image under one name. # # Usage: scripts/build-arm64-agent-images.sh # Password ssh: SSHPASS=… SSH='sshpass -e ssh' scripts/build-arm64-agent-images.sh set -euo pipefail MAC_NODES=${MAC_NODES:-"osobh@100.79.33.78"} # arm64 Mac nodes (ghost) SSH=${SSH:-ssh} IMAGES=(agent-base agent-terminal agent-browser) ROOT="$(cd "$(dirname "$0")/.." && pwd)" for i in "${IMAGES[@]}"; do echo "→ build clawmates/$i:dev (linux/arm64, native)" docker buildx build --platform linux/arm64 -t "clawmates/$i:dev" --load \ -f "$ROOT/images/$i/Dockerfile" "$ROOT/images/$i/" done for host in $MAC_NODES; do for i in "${IMAGES[@]}"; do printf ' %-26s → %s\n' "clawmates/$i:dev" "$host" docker save "clawmates/$i:dev" | $SSH "$host" "docker load" >/dev/null done done echo "✓ native arm64 agent images built + loaded"