@@ -4,51 +4,13 @@ set -o errexit
44set -o nounset
55set -o pipefail
66
7- DOCKER_CLI_EXPERIMENTAL=enabled
8-
97REGISTRY=${REGISTRY:- }
108IMAGES=" $@ "
119
1210for image in ${IMAGES[*]} ; do
13-
1411 tag=${image#*: }
15- old_registry=${image%/* }
1612 name=${image%:* }
1713 name=${name##*/ }
1814
19- echo " +++ Creating manifest image ${REGISTRY} /${name} :${tag} "
20-
21- # raw=$(docker manifest inspect "${image}")
22- # Bypass permission authorized by docker manifest inspect
23- raw=$( curl -H " User-Agent:Go-http-client/1.1" -H " Accept:application/vnd.docker.distribution.manifest.list.v2+json" " https://${old_registry} /v2/${name} /manifests/${tag} " )
24-
25- echo " +++ Pulling source images by SHA"
26- echo " ${raw} " |
27- jq -j " .manifests[] | \" ${old_registry} /${name} @\" , .digest, \" \n\" " |
28- while read X; do docker pull $X ; done
29-
30- echo " +++ Tagging images with ARCH and OS"
31- echo " ${raw} " |
32- jq -j " .manifests[] | \" docker tag ${old_registry} /${name} @\" , .digest, \" ${REGISTRY} /${name} :${tag} __\" , .platform.architecture, \" _\" , .platform.os, \" \n\" " |
33- while read X; do $X ; done
34-
35- echo " +++ Pushing images"
36- echo " ${raw} " |
37- jq -j " .manifests[] | \" docker push ${REGISTRY} /${name} :${tag} __\" , .platform.architecture, \" _\" , .platform.os, \" \n\" " |
38- while read X; do $X ; done
39-
40- echo " +++ Creating manifest"
41- docker manifest create --amend " ${REGISTRY} /${name} :${tag} " \
42- $(
43- echo " ${raw} " |
44- jq -j " .manifests[] | \" ${REGISTRY} /${name} :${tag} __\" , .platform.architecture, \" _\" , .platform.os, \" \" "
45- )
46-
47- echo " +++ Annotating manifest with ARCH and OS"
48- echo " ${raw} " |
49- jq -j " .manifests[] | \" docker manifest annotate ${REGISTRY} /${name} :${tag} ${REGISTRY} /${name} :${tag} __\" , .platform.architecture, \" _\" , .platform.os, \" --arch \" , .platform.architecture, \" --os \" , .platform.os, \" \n\" " |
50- while read X; do $X ; done
51-
52- echo " +++ Pushing manifest ${REGISTRY} /${name} :${tag} "
53- docker manifest push " ${REGISTRY} /${name} :${tag} " --purge
15+ skopeo copy --all " docker://${image} " " docker://${REGISTRY} /${name} :${tag} "
5416done
0 commit comments