Skip to content

Commit

Permalink
add workflow and add script
Browse files Browse the repository at this point in the history
  • Loading branch information
M-Kusumgar committed Jan 21, 2025
1 parent 662a4e4 commit faa6dad
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/workflows/port-images-to-ghcr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
on:
push:
branches:
- main

name: Port docker official images to GHCR

jobs:
port-images:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Login to GHCR (GitHub Packages)
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Pull from Docker Hub, push to GHCR
run: ./port-images-to-ghcr
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
# docker-official-images
# Docker Official Images

We are moving away from Docker Hub to GitHub Container Registry because of rate limiting issues. There may be certain images however, that officially available on Docker Hub so this is a small script to port those images to GHCR. You can then pull them using:

```bash
docker pull ghcr.io/mrc-ide/docker-official-images/<image-name>:<tag>
```
14 changes: 14 additions & 0 deletions port-images-to-ghcr
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/usr/bin/env bash
set -ex

declare -a docker_images=(
"redis:6"
"redis:5"
)

for image in "${docker_images[@]}"
do
docker pull "$image"
docker image tag "$image" ghcr.io/mrc-ide/docker-official-images/"$image"
docker image push ghcr.io/mrc-ide/docker-official-images/"$image"
done

0 comments on commit faa6dad

Please sign in to comment.