https://github.com/whalimeter/gh-action-image-mirror
GitHub action to mirror images between registries, defaults to the GHCR.
https://github.com/whalimeter/gh-action-image-mirror
docker-hub docker-image ghcr
Last synced: 7 months ago
JSON representation
GitHub action to mirror images between registries, defaults to the GHCR.
- Host: GitHub
- URL: https://github.com/whalimeter/gh-action-image-mirror
- Owner: whalimeter
- License: mit
- Created: 2023-08-12T20:42:47.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2023-09-26T21:41:21.000Z (about 2 years ago)
- Last Synced: 2025-03-02T00:46:12.564Z (7 months ago)
- Topics: docker-hub, docker-image, ghcr
- Language: Shell
- Homepage:
- Size: 44.9 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Docker Image Mirror
This [project] implements a [script] and GitHub [action] that will mirror images
between registries. The default is to mirror to the GHCR. For proper operation,
you will have to login both at the source and destination registry. When running
as an action and against the GHCR, you will also have to give your workflow the
permission to write packages.The [script], also used by the [action] has good defaults. When passed an image
with a tag, it will only mirror that image. Otherwise, it will only pick up
images with sharp semantic versions in their tags, and is then able to restrict
to a range of versions. The [script] supports both multi-platform and
single-platform images.The following example would mirror the Alpine images from the Docker Hub under
the repository that it is running at. It requires that a secret called
`DOCKERHUB_TOKEN` is available. Only sharp versions and versions greater or
equal to `3.18` will be mirrored.```yaml
name: mirroron:
workflow_dispatch:jobs:
mirror:
runs-on: ubuntu-latest
permissions:
packages: write
steps:
-
name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: efrecon
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Login to GHCR
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: alpine
uses: whalimeter/gh-action-image-mirror@main
with:
image: alpine
minver: "3.18"
```[project]: https://github.com/efrecon/gh-mirror-docker-mirror
[script]: ./mirror.sh
[action]: action.ymlFor more information about the action check its [inputs][action].
## Development
The `reg-tags` package is added as a subtree, as it is not possible to use
submodules in GitHub actions (their code is not automatically checked out from
calling workflows). To add the sub-project, the following command was issued:```shell
git subtree add --prefix reg-tags https://github.com/efrecon/reg-tags.git master --squash
```