diff --git a/.github/workflows/copy.yml b/.github/workflows/copy.yml new file mode 100644 index 0000000..0012390 --- /dev/null +++ b/.github/workflows/copy.yml @@ -0,0 +1,32 @@ +name: copy + +on: + push: + branches: + - main + +jobs: + copy: + runs-on: ubuntu-latest + + permissions: + packages: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Login to Docker Hub registry + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_READ_ONLY }} + - name: Login to github docker registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - uses: imjasonh/setup-crane@v0.4 + - name: copy + run: ./copy.sh "ghcr.io/${{ github.repository_owner }}" \ No newline at end of file diff --git a/copy.sh b/copy.sh new file mode 100755 index 0000000..7c8fbef --- /dev/null +++ b/copy.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -eo pipefail + +target_registry=$1 + +source_images=( + # localnet test images + "ruimarinho/bitcoin-core:22" + "ethereum/client-go:v1.10.26" + + # localnet build images + "golang:1.22.5-bookworm" +) + +for source_image in "${source_images[@]}"; do + # replaces slashes in images names with dashes + target_image_name=$(echo "${source_image}" | tr '/' '-') + crane copy "${source_image}" "${target_registry}/${target_image_name}" +done \ No newline at end of file