#!/usr/bin/env bash # Build all parts-inventory images and load them onto the required k8s nodes. # Run this from any machine with Docker and SSH access to the nodes. set -euo pipefail SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" NODE2_IP="192.168.2.195" # kube-node-2 (worker) NODE3_IP="192.168.2.196" # kube-node-3 (control-plane + worker) echo "=== Building parts-api:latest ===" docker build -t parts-api:latest "$SCRIPT_DIR/api" echo "=== Building parts-ui:latest ===" docker build -t parts-ui:latest "$SCRIPT_DIR/ui" echo "=== Building parts-cli:latest ===" docker build -t parts-cli:latest "$SCRIPT_DIR/cli" for node_ip in "$NODE2_IP" "$NODE3_IP"; do echo "=== Loading images onto $node_ip ===" for img in parts-api:latest parts-ui:latest parts-cli:latest; do echo " → $img" docker save "$img" | ssh "dan@$node_ip" "sudo ctr --namespace k8s.io images import -" done done echo "" echo "=== All images loaded. Apply the manifest with: ===" echo " kubectl apply -f /home/dan/homelab/deployment/infrastructure/parts-inventory.yaml"