Skip to content

dockerhub-mirror

dockerhub-mirror #10

Workflow file for this run

name: dockerhub-mirror
on:
workflow_dispatch:
inputs:
dockerhub-repo:
description: 'DockerHub repository'
required: true
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: ${{ vars.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GitHub Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Pull ${{ github.event.inputs.dockerhub-repo }}
run:
docker pull ${{ github.event.inputs.dockerhub-repo }}
- name: Mirror ${{ github.event.inputs.dockerhub-repo }} to ${{ github.repository_owner }}/${{ github.event.inputs.dockerhub-repo }}
run: |
docker tag ${{ github.event.inputs.dockerhub-repo }} ghcr.io/${{ github.repository_owner }}/${{ github.event.inputs.dockerhub-repo }}
docker push ghcr.io/${{ github.repository_owner }}/${{ github.event.inputs.dockerhub-repo }}