From e0b6a109319e47d63dbca411eeb51d06e1f27bad Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Tue, 28 Jun 2022 22:10:56 +0500 Subject: [PATCH] Add alpine:3.16.0 for mirrorring and add ability to check if image mirrorred. --- images/alpine.sh | 2 ++ mirror.sh | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) create mode 100644 images/alpine.sh diff --git a/images/alpine.sh b/images/alpine.sh new file mode 100644 index 0000000..0d86259 --- /dev/null +++ b/images/alpine.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +echo "alpine:3.16.0" diff --git a/mirror.sh b/mirror.sh index 7d4f9ca..d99a259 100755 --- a/mirror.sh +++ b/mirror.sh @@ -51,9 +51,15 @@ function get_amd64_image() { image_name=$(echo "${image}" | cut -d":" -f 1) image_version=$(echo "${image}" | cut -d":" -f 2) + # Check if amd64 layers should be fetched. + if docker manifest inspect "${REMOTE_IMAGE}-amd64" &> /dev/null; then + echo -e "\t* Layers for amd64 architecture for this image exist." + + return + fi + echo -ne "\t* Getting amd64 layers... " - # arm64 layers might be missing. So we just put "FAIL!" here and do nothing else. if ! docker pull --platform=linux/amd64 "${image}" &> /dev/null; then echo "FAIL!" @@ -79,6 +85,13 @@ function get_arm64_image() { image_name=$(echo "${image}" | cut -d":" -f 1) image_version=$(echo "${image}" | cut -d":" -f 2) + # Check if arm64 layers should be fetched. + if docker manifest inspect "${REMOTE_IMAGE}-arm64" &> /dev/null; then + echo -e "\t* Layers for arm64 architecture for this image exist." + + return + fi + echo -ne "\t* Getting arm64 layers... " # arm64 layers might be missing. So we just put "FAIL!" here and do nothing else.