#!/bin/bash
set -x 

oldrepo="nvcr.io/nvidia/cloud-native"
newrepo=ict-harbor-pro-registry-huabei2.crs.ctyun.cn/ict

dockerimages=(
gpu-operator-validator:v24.9.1
k8s-driver-manager:v0.7.0
k8s-kata-manager:v0.2.2
vgpu-device-manager:v0.2.8
k8s-cc-manager:v0.1.1
dcgm:3.3.9-1-ubuntu22.04
k8s-mig-manager:v0.10.0-ubuntu20.04
gdrdrv:v2.4.1-2
)

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

