From c2cb4fac106fc74efe30288348b6b1679d5dd7d0 Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 5 Sep 2024 10:02:04 +0200 Subject: [PATCH] Sync docker images from docker hub to ghcr --- .github/workflows/sync-docker-images.yaml | 25 +++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 .github/workflows/sync-docker-images.yaml diff --git a/.github/workflows/sync-docker-images.yaml b/.github/workflows/sync-docker-images.yaml new file mode 100644 index 000000000..aa00da957 --- /dev/null +++ b/.github/workflows/sync-docker-images.yaml @@ -0,0 +1,25 @@ +name: Sync Docker Images + +on: + workflow_dispatch: + schedule: + - cron: "0 0 * * *" # Run every day + +jobs: + sync: + runs-on: ubuntu-latest + permissions: + packages: write + contents: read + if: github.repository == 'traefik/traefik' + + steps: + - uses: actions/checkout@v4 + + - uses: imjasonh/setup-crane@v0.4 + + - name: Sync + run: | + EXCLUDED_TAGS="1.7.9-alpine v1.0.0-beta.392 v1.0.0-beta.404 v1.0.0-beta.704 v1.0.0-rc1 v1.7.9-alpine" + EXCLUDED_REGEX=$(echo $EXCLUDED_TAGS | sed 's/ /|/g') + diff <(crane ls traefik) <(crane ls ghcr.io/traefik/traefik) | grep '^<' | awk '{print $2}' | while read -r tag; do [[ "$tag" =~ ^($EXCLUDED_REGEX)$ ]] || (echo "Processing image: traefik:$tag"; crane cp "traefik:$tag" "ghcr.io/traefik/traefik:$tag"); done