Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add workflow for multiarch & ghcr support #40

Merged

Conversation

azrikahar
Copy link
Contributor

@azrikahar azrikahar commented Jun 22, 2021

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 the docker/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 green Run workflow button to trigger it. A sample screenshot depicting the steps is shown below:
image

Proof of workflow working in my forked repo

Terminal screenshot on a Raspberry Pi on arm64 architecture

  • Pulling the image from both DockerHub and ghcr:
    image
  • Backing up an existing out-of-the-box nginx data volume and showing the content:
    image

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:
chrome_VbgpRS51PP
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 here

Once 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.

@loomchild
Copy link
Owner

Hi and thanks for submitting this! I will review and test it as soon as I can (probably in a few weeks).

@ksurl
Copy link
Contributor

ksurl commented Jul 15, 2021

looks good to me

@loomchild
Copy link
Owner

Sorry for delay. This looks perfect, thank you very much. I will merge it and run some tests. I didn't realize there are docker actions for Buildx and QEMU already.

After the merge I will configure it to trigger on every push.

@loomchild loomchild merged commit a3b2d9f into loomchild:master Aug 7, 2021
@azrikahar
Copy link
Contributor Author

Sorry for delay. This looks perfect, thank you very much. I will merge it and run some tests. I didn't realize there are docker actions for Buildx and QEMU already.

After the merge I will configure it to trigger on every push.

No worries, glad it works!

In hindsight, just noticed I should've mentioned the manual workflow trigger was just a temp solution since my intention was to let you decide what trigger(s) suit your need haha. Cheers

@azrikahar azrikahar deleted the docker-publish-multiarch-multiregistry branch August 7, 2021 22:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add image to ghcr.io repository Multi-arch builds for arm64
3 participants