Skip to content

Mirror Docker Image to GHCR #1

Mirror Docker Image to GHCR

Mirror Docker Image to GHCR #1

Workflow file for this run

name: Mirror Docker Image to GHCR
on:
workflow_dispatch:
inputs:
image_name:
description: 'Docker image name (e.g., myorg/myimage:tag)'
required: true
env:
REGISTRY: ghcr.io
jobs:
publish-to-ghcr:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Skopeo
uses: warjiang/setup-skopeo@latest
- name: Login to GitHub Container Registry
uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Copy image to GHCR
env:
IMAGE: ${{ github.event.inputs.image_name }}
run: |
NEW_IMAGE_NAME="${IMAGE//\//-}"
skopeo copy \
--dest-creds="${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}" \
"docker://${{ github.event.inputs.image_name }}" \
"docker://${{ env.REGISTRY }}/1mgr/${{ github.event.inputs.image_name }}"