Skip to content

Mirror Dockerhub

Mirror Dockerhub #1616

Workflow file for this run

name: Mirror Dockerhub
on:
workflow_dispatch:
schedule:
- cron: '0 0 * * *'
jobs:
mirror:
name: Mirror
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- image: alpine
repo: docker.io
- image: busybox
repo: docker.io
- image: debian
repo: docker.io
- image: golang
repo: docker.io
- image: mysql
repo: docker.io
- image: node
repo: docker.io
- image: openjdk
repo: docker.io
- image: postgres
repo: docker.io
- image: python
repo: docker.io
- image: rust
repo: docker.io
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v4
- uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}
- uses: actions/setup-go@v5
- uses: imjasonh/setup-crane@v0.4
- name: Mirror
run: |
for tag in $(cat ./images/${{ matrix.image }}); do
crane copy \
${{ matrix.repo }}/${{ matrix.image }}:$tag \
ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:$tag
done