about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMarcoIeni <11428655+MarcoIeni@users.noreply.github.com>2025-01-17 12:59:48 +0100
committerMarcoIeni <11428655+MarcoIeni@users.noreply.github.com>2025-01-17 12:59:48 +0100
commit5f495153f02f86055c5672c1633f9a19502066ce (patch)
tree6755182e528ac0cc9ccbcec837206674dcdb1092
parent0c2c096e1ac471b0c34629f9820a7cb1e6d4695d (diff)
downloadrust-5f495153f02f86055c5672c1633f9a19502066ce.tar.gz
rust-5f495153f02f86055c5672c1633f9a19502066ce.zip
ci: mirror buildkit image to ghcr
-rw-r--r--.github/workflows/ghcr.yml23
1 files changed, 17 insertions, 6 deletions
diff --git a/.github/workflows/ghcr.yml b/.github/workflows/ghcr.yml
index 0fcd1b17816..4a08bcbb8a6 100644
--- a/.github/workflows/ghcr.yml
+++ b/.github/workflows/ghcr.yml
@@ -48,10 +48,21 @@ jobs:
 
       - name: Mirror DockerHub
         run: |
-          # DockerHub image we want to mirror
-          image="ubuntu:22.04"
+          # List of DockerHub images to mirror to ghcr.io
+          images=(
+            # Mirrored because used by the mingw-check-tidy, which doesn't cache Docker images
+            "ubuntu:22.04"
+            # Mirrored because used by all linux CI jobs, including mingw-check-tidy
+            "moby/buildkit:buildx-stable-1"
+          )
 
-          # Mirror image from DockerHub to ghcr.io
-          ./crane copy \
-            docker.io/${image} \
-            ghcr.io/${{ github.repository_owner }}/${image}
+          # Mirror each image from DockerHub to ghcr.io
+          for img in "${images[@]}"; do
+            echo "Mirroring ${img}..."
+            # Remove namespace from the image if any.
+            # E.g. "moby/buildkit:buildx-stable-1" becomes "buildkit:buildx-stable-1"
+            dest_image=$(echo "${img}" | cut -d'/' -f2-)
+            ./crane copy \
+              "docker.io/${img}" \
+              "ghcr.io/${{ github.repository_owner }}/${dest_image}"
+          done