homelab/services/device-inventory/build-and-load.sh
Dan V deb6c38d7b chore: commit homelab setup — deployment, services, orchestration, skill
- Add .gitignore: exclude compiled binaries, build artifacts, and Helm
  values files containing real secrets (authentik, prometheus)
- Add all Kubernetes deployment manifests (deployment/)
- Add services source code: ha-sync, device-inventory, games-console,
  paperclip, parts-inventory
- Add Ansible orchestration: playbooks, roles, inventory, cloud-init
- Add hardware specs, execution plans, scripts, HOMELAB.md
- Add skills/homelab/SKILL.md + skills/install.sh to preserve Copilot skill
- Remove previously-tracked inventory-cli binary from git index

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-04-09 08:10:32 +02:00

34 lines
1.5 KiB
Bash
Executable file

#!/usr/bin/env bash
# Build all device-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 (server + web-ui + cli CronJob)
NODE3_IP="192.168.2.196" # kube-node-3 (cli CronJob only)
echo "=== Building inventory-server:latest ==="
docker build -t inventory-server:latest -f "$SCRIPT_DIR/Dockerfile" "$SCRIPT_DIR"
echo "=== Building device-inventory:latest (CLI) ==="
docker build -t device-inventory:latest -f "$SCRIPT_DIR/Dockerfile.cli" "$SCRIPT_DIR"
echo "=== Building inventory-web-ui:latest ==="
docker build -t inventory-web-ui:latest -f "$SCRIPT_DIR/web-ui/Dockerfile" "$SCRIPT_DIR/web-ui"
echo "=== Loading images onto kube-node-2 ($NODE2_IP) ==="
for img in inventory-server:latest inventory-web-ui:latest device-inventory:latest; do
echo "$img"
docker save "$img" | ssh "dan@$NODE2_IP" "sudo ctr --namespace k8s.io images import -"
done
echo "=== Loading images onto kube-node-3 ($NODE3_IP) ==="
for img in inventory-server:latest inventory-web-ui:latest device-inventory:latest; do
echo "$img"
docker save "$img" | ssh "dan@$NODE3_IP" "sudo ctr --namespace k8s.io images import -"
done
echo ""
echo "=== All images loaded. Apply the manifest with: ==="
echo " kubectl apply -f /home/dan/homelab/deployment/infrastructure/device-inventory.yaml"