From 68137b31c1a5d09ca5dc20de7e6cbf060bd3dbe3 Mon Sep 17 00:00:00 2001 From: "Stanislav N. aka pztrn" Date: Mon, 27 Jun 2022 13:07:04 +0500 Subject: [PATCH] Removed doonation link and removed arm64 mirroring as gitea unable to handle it properly. --- README.md | 2 -- mirror.sh | 15 +++++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 10f332a..2e60554 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,6 @@ Docker Hub ratelimiting shit. Feel free to use and re-use these images and this mirrorer. -If it helps you much - please, [donate](https://paypal.me/pztrn) - ## How to use This script assumes that you are already logged in into Gitlab Registry. diff --git a/mirror.sh b/mirror.sh index b154e40..a52124e 100755 --- a/mirror.sh +++ b/mirror.sh @@ -13,15 +13,22 @@ function mirror() { image_name=$(echo "${image}" | cut -d":" -f 1) image_version=$(echo "${image}" | cut -d":" -f 2) - echo -n "Mirroring ${image}... " + echo -n "Mirroring ${image} for '${os_and_arch}'... " + + if ! docker pull --platform="${os_and_arch}" "${image}" &> /dev/null; then echo "PULL FAILED" - exit 1 + if [ "${os_and_arch/linux\/amd64//}" != "${os_and_arch}" ] ; then + exit 1 + fi + + return fi # shellcheck disable=SC1083 image_hash=$(docker images -a | grep "^${image_name}" | grep "${image_version}" | awk {' print $3 '}) - echo -n "${image_hash} received, retag as '${DESTINATION_PROJECT}/${image}'... " + echo -n "${image_hash} for '${os_and_arch}' received, retag as '${DESTINATION_PROJECT}/${image}'... " + if ! docker tag "${image_hash}" "${DESTINATION_PROJECT}/${image}" &> /dev/null; then echo "TAGGING FAILED" @@ -69,5 +76,5 @@ docker login -u "${USER}" -p "${PASSWORD}" "${DESTINATION_REGISTRY}" # Mirror images. for image in "${WHAT_TO_MIRROR[@]}"; do mirror "${image}" linux/amd64 - mirror "${image}" linux/arm64 + #mirror "${image}" linux/arm64 done