ghaction-dockerhub-mirror icon indicating copy to clipboard operation
ghaction-dockerhub-mirror copied to clipboard

GitHub Action to mirror a DockerHub repo to another registry

trafficstars

GitHub release CI workflow Become a sponsor Paypal Donate

About

GitHub Action composite to mirror a DockerHub repo to another registry.

Screenshot


  • Usage
  • Contributing
  • License

Usage

name: dockerhub-mirror

on:
  workflow_dispatch:
    inputs:
      dockerhub-repo:
        description: 'DockerHub repository'
        required: true
      dest-registry:
        description: 'Destination registry (eg. ghcr.io)'
        required: true
      dest-repo:
        description: 'Destination repository (eg. username/repo)'
        required: true
      dry-run:
        description: 'Dry run'
        required: false
        default: 'false'

jobs:
  dockerhub-mirror:
    runs-on: ubuntu-latest
    steps:
      -
        name: Set up QEMU
        uses: docker/setup-qemu-action@v2
      -
        name: Set up Docker Buildx
        uses: docker/setup-buildx-action@v2
      -
        name: Login to DockerHub
        uses: docker/login-action@v2
        with:
          username: ${{ secrets.DOCKERHUB_USERNAME }}
          password: ${{ secrets.DOCKERHUB_TOKEN }}
      -
        name: Login to ${{ github.event.inputs.dest-registry }}
        uses: docker/login-action@v2
        with:
          registry: ${{ github.event.inputs.dest-registry }}
          username: ${{ secrets.DEST_USERNAME }}
          password: ${{ secrets.DEST_PASSWORD }}
      -
        name: Mirror ${{ github.event.inputs.dockerhub-repo }} to ${{ github.event.inputs.dest-registry }}/${{ github.event.inputs.dest-repo }}
        uses: crazy-max/ghaction-dockerhub-mirror@v1
        with:
          dockerhub-username: ${{ secrets.DOCKERHUB_USERNAME }}
          dockerhub-password: ${{ secrets.DOCKERHUB_TOKEN }}
          dockerhub-repo: ${{ github.event.inputs.dockerhub-repo }}
          dest-registry: ${{ github.event.inputs.dest-registry }}
          dest-repo: ${{ github.event.inputs.dest-repo }}
          dry-run: ${{ github.event.inputs.dry-run }}

Customizing

inputs

See action.yml

Contributing

Want to contribute? Awesome! The most basic way to show your support is to star the project, or to raise issues. If you want to open a pull request, please read the contributing guidelines.

You can also support this project by becoming a sponsor on GitHub or by making a Paypal donation to ensure this journey continues indefinitely!

Thanks again for your support, it is much appreciated! :pray:

License

MIT. See LICENSE for more details.