55 lines
1.7 KiB
Bash
Executable File
55 lines
1.7 KiB
Bash
Executable File
#!/bin/bash
|
|
set -e
|
|
|
|
# Configuration
|
|
SOURCE_REGISTRY="ghcr.io/evanjarrett/hsm-secrets-operator"
|
|
TARGET_REGISTRY="atcr.io/evan.jarrett.net/hsm-secrets-operator"
|
|
TAG="latest"
|
|
|
|
# Image digests
|
|
AMD64_DIGEST="sha256:274284a623810cf07c5b4735628832751926b7d192863681d5af1b4137f44254"
|
|
ARM64_DIGEST="sha256:b57929fd100033092766aad1c7e747deef9b1e3206756c11d0d7a7af74daedff"
|
|
|
|
echo "=== Migrating multi-arch image from GHCR to ATCR ==="
|
|
echo "Source: ${SOURCE_REGISTRY}"
|
|
echo "Target: ${TARGET_REGISTRY}:${TAG}"
|
|
echo ""
|
|
|
|
# Tag and push amd64 image
|
|
echo ">>> Tagging and pushing amd64 image..."
|
|
docker tag "${SOURCE_REGISTRY}@${AMD64_DIGEST}" "${TARGET_REGISTRY}:${TAG}-amd64"
|
|
docker push "${TARGET_REGISTRY}:${TAG}-amd64"
|
|
echo ""
|
|
|
|
# Tag and push arm64 image
|
|
echo ">>> Tagging and pushing arm64 image..."
|
|
docker tag "${SOURCE_REGISTRY}@${ARM64_DIGEST}" "${TARGET_REGISTRY}:${TAG}-arm64"
|
|
docker push "${TARGET_REGISTRY}:${TAG}-arm64"
|
|
echo ""
|
|
|
|
# Create multi-arch manifest using the pushed tags
|
|
echo ">>> Creating multi-arch manifest..."
|
|
docker manifest create "${TARGET_REGISTRY}:${TAG}" \
|
|
--amend "${TARGET_REGISTRY}:${TAG}-amd64" \
|
|
--amend "${TARGET_REGISTRY}:${TAG}-arm64"
|
|
echo ""
|
|
|
|
# Annotate the manifest with platform information
|
|
echo ">>> Annotating manifest with platform information..."
|
|
docker manifest annotate "${TARGET_REGISTRY}:${TAG}" \
|
|
"${TARGET_REGISTRY}:${TAG}-amd64" \
|
|
--os linux --arch amd64
|
|
|
|
docker manifest annotate "${TARGET_REGISTRY}:${TAG}" \
|
|
"${TARGET_REGISTRY}:${TAG}-arm64" \
|
|
--os linux --arch arm64
|
|
echo ""
|
|
|
|
# Push the manifest list
|
|
echo ">>> Pushing multi-arch manifest..."
|
|
docker manifest push "${TARGET_REGISTRY}:${TAG}"
|
|
echo ""
|
|
|
|
echo "=== Migration complete! ==="
|
|
echo "You can now pull: docker pull ${TARGET_REGISTRY}:${TAG}"
|