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 multi-arch support to docker image #23

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

kylekingcdn
Copy link

@kylekingcdn kylekingcdn commented Jan 14, 2024

I recently migrated my metrics server to a Raspberry Pi and discovered that my I could no longer run this image. I've added arm64 support to my own fork and figured I might as well submit a PR.

I've added a copy of the build script that handles multi-arch docker builds while trying to make as few changes as possible. It handles building for both linux/amd64 and linux/arm64. A couple notes on the build script:

  • The target architectures are hardcoded right now.
  • The easiest way to push docker buildx images is to use a single build call which include all of the desired tags and pushes the built images. That's what the odd bash array of image tag arguments is for (relevant commit).

The original (unmodified) build script continues to work fine with the Dockerfile changes i've made.

I've pushed an image made with these changes to my own docker hub repo as an example result.

This creates a bash array of tag arguments (`--tag TAG`) for use in the docker build call.

This allows for combining the build and push command (required for pushing multi-arch images with `docker buildx build`)
@codecov-commenter
Copy link

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cb323ff) 74.53% compared to head (8824983) 74.53%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##             main      #23   +/-   ##
=======================================
  Coverage   74.53%   74.53%           
=======================================
  Files           7        7           
  Lines         644      644           
=======================================
  Hits          480      480           
  Misses        131      131           
  Partials       33       33           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@irvinlim
Copy link
Owner

irvinlim commented Jan 21, 2024

Hi @kylekingcdn thanks for the PR!

Upon further investigation, I realized that ./hack/push-docker.sh is not actually used by the GitHub Action for Docker release (the manual push-docker.sh script was added first, before the GitHub release.yml action was added later in #9).

As such, it does seem like we should be updating the release.yml action to automatically release a multi-arch image, rather than adding a new push-docker-multiarch.sh Bash script (which would only be useful for doing a manual release).

I'll look into updating the release.yml action shortly in a separate PR, which would also satisfy your needs for an arm64-based image. Nevertheless, thanks for your input!

@kylekingcdn
Copy link
Author

For sure, that makes sense.
And yes thank you, adding support for arm64 docker support would be great.

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.

3 participants