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

Dockerfile: build arm64 variants #449

Merged
merged 2 commits into from
Nov 11, 2024
Merged

Conversation

akerouanton
Copy link
Contributor

@akerouanton akerouanton commented Nov 1, 2024

Make it possible to build both amd64 and arm64 Docker images. This can be done with:

docker build --platform linux/amd64,linux/arm64 --tag pwru  .

GHA release workflow only handles GH release artifacts, so the out-of-tree CI job or manual process used to publish images on Docker Hub will have to be updated accordingly.

Also, fix the release script used during image build to support cross-compilation of amd64 on arm64 machines.

(Note that a standalone Docker Engine has to be configured with the containerd snapshotter enabled to build multi-arch images. See https://docs.docker.com/engine/storage/containerd/)

@akerouanton akerouanton requested a review from a team as a code owner November 1, 2024 17:09
@akerouanton akerouanton requested review from jschwinger233 and removed request for a team November 1, 2024 17:09
@akerouanton akerouanton marked this pull request as draft November 1, 2024 17:53
Make it possible to build both amd64 and arm64 Docker images. This can
be done with:

    docker build --platform linux/amd64,linux/arm64 --tag pwru  .

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
When deb pkg 'gcc' is installed, arch-specific symlinks are created (eg.
x86_64-linux-gnu-gcc).

Change the release script to use the x86 symlink instead of 'gcc'. That
way, amd64 can be built from arm64 machine.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
@akerouanton akerouanton marked this pull request as ready for review November 1, 2024 20:08
Copy link
Member

@jschwinger233 jschwinger233 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@brb You know this better than me, how do you like it?

Copy link
Member

@brb brb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@brb brb merged commit dec5911 into cilium:main Nov 11, 2024
6 checks passed
@akerouanton akerouanton deleted the dockerfile-arm64 branch November 11, 2024 16:46
@brb
Copy link
Member

brb commented Nov 12, 2024

@akerouanton I was informed by @aanm that Docker Hub, where we publish cilium/pwru images, does not support the multi-arch.

@akerouanton
Copy link
Contributor Author

Docker Hub [...] does not support the multi-arch.

What do you mean @aanm? Docker Hub itself does support multi-arch images. For instance: https://hub.docker.com/r/albinkerouanton006/pwru/tags.

@aanm
Copy link
Member

aanm commented Nov 12, 2024

@brb @akerouanton what I meant was that hub.docker.com does not build multi-arch images but it's fine to publish.

@akerouanton
Copy link
Contributor Author

@aanm I see. I think a build hook could do the job, but Cilium needs to have either a Docker Pro, Team, or Business subscription as is noted at the top of that doc page. Is that the case?

@aanm
Copy link
Member

aanm commented Nov 27, 2024

@aanm I see. I think a build hook could do the job, but Cilium needs to have either a Docker Pro, Team, or Business subscription as is noted at the top of that doc page. Is that the case?

@akerouanton no, that's not the case. All multi-arch builds that Cilium has are done via GitHub actions. For example here

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.

Multi-arch container image
4 participants