mirror of
https://github.com/Start9Labs/start-os.git
synced 2026-03-30 20:14:49 +00:00
build: add migration image bundling to build pipeline
Bundle start9/compat, start9/utils, and tonistiigi/binfmt container images into the OS image so the v1→v2 s9pk migration can run without internet access.
This commit is contained in:
33
build/save-migration-images.sh
Executable file
33
build/save-migration-images.sh
Executable file
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Save Docker images needed by the 0.3.6-alpha.0 migration as tarballs
|
||||
# so they can be bundled into the OS and loaded without internet access.
|
||||
set -e
|
||||
|
||||
ARCH="${ARCH:-x86_64}"
|
||||
DESTDIR="${1:-build/lib/migration-images}"
|
||||
|
||||
if [ "$ARCH" = "x86_64" ]; then
|
||||
DOCKER_PLATFORM="linux/amd64"
|
||||
elif [ "$ARCH" = "aarch64" ]; then
|
||||
DOCKER_PLATFORM="linux/arm64"
|
||||
else
|
||||
DOCKER_PLATFORM="linux/$ARCH"
|
||||
fi
|
||||
|
||||
IMAGES=("start9/compat:latest" "start9/utils:latest" "tonistiigi/binfmt:latest")
|
||||
|
||||
mkdir -p "$DESTDIR"
|
||||
|
||||
for IMAGE in "${IMAGES[@]}"; do
|
||||
FILENAME=$(echo "$IMAGE" | sed 's|/|_|g; s/:/_/g').tar
|
||||
if [ -f "$DESTDIR/$FILENAME" ]; then
|
||||
echo "Skipping $IMAGE (already saved)"
|
||||
continue
|
||||
fi
|
||||
echo "Pulling $IMAGE for $DOCKER_PLATFORM..."
|
||||
docker pull --platform "$DOCKER_PLATFORM" "$IMAGE"
|
||||
echo "Saving $IMAGE to $DESTDIR/$FILENAME..."
|
||||
docker save "$IMAGE" -o "$DESTDIR/$FILENAME"
|
||||
done
|
||||
|
||||
echo "Migration images saved to $DESTDIR"
|
||||
Reference in New Issue
Block a user