add workflow for multiarch & ghcr support #40
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Preface: To correlate the descriptions/instructions, I will sometimes mention to look at line X of the workflow, which is
.github/workflow/publish-image.yml
.Multi Architecture support
Resolves #34
This PR introduces a github action workflow to automate building
volume-backup
into 3 architectures (refer line 36 of workflow), namely:linux/amd64
linux/arm64
linux/arm/v7
Setup referenced from https://github.com/docker/build-push-action/blob/master/docs/advanced/multi-platform.md
Pushes to DockerHub and GHCR at the same time
Resolves #35
Refer line 20-31 of workflow. The tags in the end (line 39-40), particular
ghcr.io
prefix, indicates to thedocker/build-push-action@v2
step to push to each of the registry.Setup referenced from https://github.com/docker/build-push-action/blob/master/docs/advanced/push-multi-registries.md
How does the workflow triggers
The trigger for the github action is manual (on
workflow_dispatch
, line 3-4 of workflow).The maintainers can go to Actions tab, click on publish-image workflow on the left, click on
Run workflow
on the bottom right there, then click on the greenRun workflow
button to trigger it. A sample screenshot depicting the steps is shown below:Proof of workflow working in my forked repo
Terminal screenshot on a Raspberry Pi on arm64 architecture
Published images
Action items needed for maintainers before merging this PR
2 new repository secrets are needed to be created in order for the github action step Login to Dockerhub to use
secrets.DOCKERHUB_USERNAME
&secrets.DOCKERHUB_TOKEN
(line 23-24) to login to loomchild dockerhub account successfully to push the resulting image.Sample screenshot:
Reference from github docs: https://docs.github.com/en/actions/reference/encrypted-secrets
As for the
secrets.GITHUB_TOKEN
on line 31, it is generated automatically for us so we don't have to do anything here. Refer official docs hereOnce the 2 dockerhub secrets are added and the PR is merged, the maintainers will just need to trigger the workflow once to resolve the 2 issues referenced in the beginning.