-
-
Notifications
You must be signed in to change notification settings - Fork 235
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Externalize mirroring from ghcr.io to docker hub in another workflow …
…to avoid memory issues
- Loading branch information
Showing
3 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: Mirror docker image | ||
|
||
on: | ||
workflow_dispatch: | ||
inputs: | ||
source-image: | ||
description: 'Source of the image on ghcr.io' | ||
required: true | ||
target-image: | ||
description: 'Target of the image hosted on docker hub' | ||
required: true | ||
free-space-before: | ||
description: 'Free space on the runner before pulling and pushing docker image' | ||
required: false | ||
default: 'true' | ||
|
||
jobs: | ||
copy-to-docker-hub: | ||
runs-on: ubuntu-latest | ||
environment: | ||
name: beta | ||
steps: | ||
# Free disk space | ||
- name: Free Disk space | ||
if: github.event.inputs.free-space-before == 'true' | ||
shell: bash | ||
run: | | ||
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android | ||
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET | ||
# Login to docker hub | ||
- name: Login to Docker Hub | ||
uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME }} | ||
password: ${{ secrets.DOCKER_PASSWORD }} | ||
# Copy ghrc.io image to Docker Hub | ||
- name: Pull image from GHCR | ||
run: docker pull "${{ github.event.inputs.source-image }}" | ||
- name: Tag image for Docker Hub | ||
run: docker tag "${{ github.event.inputs.source-image }}" "${{ github.event.inputs.target-image }}" | ||
- name: Push image to Docker Hub | ||
run: docker push "${{ github.event.inputs.target-image }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters