Files
omnex/deploy/chart-gestion/distribute-image.sh
T

22 lines
712 B
Bash

#!/usr/bin/env bash
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)"
echo "▶ Build"
docker build -f "$SCRIPT_DIR/frontend/Dockerfile" -t gestion-frontend:latest "$PROJECT_ROOT"
echo "▶ Export"
docker save gestion-frontend:latest -o /tmp/gestion-frontend.tar
for NODE in 192.168.1.43 192.168.1.44 192.168.1.45; do
echo "→ $NODE"
ssh xor@$NODE "sudo k3s ctr images rm docker.io/library/gestion-frontend:latest 2>/dev/null; true"
scp /tmp/gestion-frontend.tar xor@$NODE:/tmp/
ssh xor@$NODE "sudo k3s ctr images import /tmp/gestion-frontend.tar && rm /tmp/gestion-frontend.tar"
done
rm -f /tmp/gestion-frontend.tar
echo "✓ Done"