#!/bin/bash
set -x 

dockerimages=(
kong:3.8
docker.io/kubernetesui/dashboard-api:1.10.2
docker.io/kubernetesui/dashboard-auth:1.2.3
docker.io/kubernetesui/dashboard-metrics-scraper:1.2.2
docker.io/kubernetesui/dashboard-web:1.6.1
)

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

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

    let j+=1
done
set +x

