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

Multi architecture container image #350

Merged

Conversation

gabriel-duque
Copy link
Contributor

This PR would allow for a multi-architecture container image to be built and (sometimes) pushed to Docker hub when necessary.

In order for this to work, 2 things were done:

  • Rewrite the Dockerfile to built the chartmuseum executable inside a Docker container in a portable way.
  • Add a GitHub action to leverage docker buildx and "cross-build" the container image for multiple architectures.

In order for this to work, 2 secrets need to be added to the helm/chartmuseum GitHub repository.

The first one called DOCKER_USERNAME should be the Docker hub username for the "chartmuseum" account.

The second one called DOCKER_PASSWORD should be an access token generated on Docker hub like explained here.

The images will be built for the following architectures:

  • amd64 (x86_64)
  • i386 (x86)
  • armv8 (aarch64/arm64)
  • armv7
  • armv6

The images will be built (and sometimes pushed) in the following circumstances:

  • on pull requests (just built)
  • on tag pushes when the tag matches: vX.Y.Z (built and pushed as chartmuseum/chartmuseum:X.Y.Z and chartmuseum/chartmuseum:latest)
  • on pushes to master (built and pushed as chartmuseum/chartmuseum:edge and chartmuseum/chartmuseum:latest)
  • every night at midnight UTC to pull in updates in the dependencies, the golang image and the alpine image (built and pushed as chartmuseum/chartmuseum:nightly and chartmuseum/chartmuseum:latest)

In order to test this would work, I have built and deployed the multi-architecture image to my own Docker hub account and tested it on the armv8 architecture.

If someone wants to test any other architecture, the image can be found here.

This PR resolves #349 .

In order to be able to build a multi-architecture image easily, all
architectures should share the same Dockerfile. For this to be possible
in a portable way, the `chartmuseum` executable should be built inside a
container image.

This commit adds a first step to the container image building which is
the build of chartmuseum itself. In order to keep the image as small as
possible, this is done inside a "builder" image and the produced
executable is then copied into the final image.

Signed-off-by: Gabriel Duque <[email protected]>
@helm-bot helm-bot added the size/L label Jul 4, 2020
@thelinuxfoundation
Copy link

Thank you for your pull request. Before we can look at your contribution, we need to ensure all contributors are covered by a Contributor License Agreement.

After the following items are addressed, please respond with a new comment here, and the automated system will re-verify.

Regards,
CLA GitHub bot

@gabriel-duque
Copy link
Contributor Author

Just for the sake of being precise: I have only tested local storage as that is what I use.

I have tested it on amd64 and arm64.

@gabriel-duque gabriel-duque force-pushed the multi-architecture-container-image branch from 515bd22 to 07e07bc Compare July 6, 2020 08:14
This commit adds a GitHub action using `docker buildx` to build and push
a multi-architecture image to Docker hub.

Signed-off-by: Gabriel Duque <[email protected]>
@gabriel-duque gabriel-duque force-pushed the multi-architecture-container-image branch from 07e07bc to c7c530b Compare July 6, 2020 08:14
@jdolitsky
Copy link
Contributor

@zuh0 thanks for looking into this, will take a look as soon as possible

@jdolitsky
Copy link
Contributor

This is pretty well thought out. I'm going to go ahead and merge. Going to update to use some alt image destination for a week or so to see how it works out before cutting over to chartmuseum/chartmuseum

@jdolitsky jdolitsky merged commit d28a492 into helm:master Jul 14, 2020
@jdolitsky jdolitsky added this to the v0.13.0 milestone Nov 12, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Multi-architecture Docker images
4 participants