#!/bin/bash
set -x 

oldrepo=quay.io/kubevirt
newrepo=ict-harbor-pro-registry-huabei2.crs.ctyun.cn/ict

dockerimages=(
bridge-marker:0.12.0
)

j=1
for i in ${dockerimages[@]}
do
    echo $i
    echo $j
    #for amd64
    docker pull --platform linux/amd64 $oldrepo/$i
    docker tag $oldrepo/$i $newrepo/$i-amd64
    docker save $newrepo/$i-amd64 -o $j-amd64.tar 
    xz $j-amd64.tar
    docker rmi $oldrepo/$i $newrepo/$i-amd64

    #for arm64
    docker pull --platform linux/arm64 $oldrepo/$i
    docker tag $oldrepo/$i $newrepo/$i-arm64
    docker save $newrepo/$i-arm64 -o $j-arm64.tar 
    xz $j-arm64.tar
    docker rmi $oldrepo/$i $newrepo/$i-arm64

    let j+=1
done
set +x

