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

Allow flexible architecture on containerbuilds depending on the build platform. #4361

Merged

Conversation

tibeer
Copy link
Contributor

@tibeer tibeer commented Jul 25, 2024

Based on https://docs.docker.com/build/guide/multi-platform/#platform-build-arguments
you can use variables like TARGETARCH or TARGETOS to determine the architecture used in the build command
inside the Dockerfile. This would allow multiarch binary builds for the server.

relates #4339
relates #3994

Signed-off-by: Tim Beermann [email protected]

Description

The current multi-arch builds only build the container image for the desired architecture, the go binary inside is still build with the wrong architecture. This PR tries to automatically adopt the build arguments to the related architecture given in the build command.

Changelog

Changed the server Dockerfile to allow platform agnostic build arguments. E.g. arm64 when docker buildx is running for platform linux/arm64.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • The light- and dark-theme are both supported and tested
  • The design was implemented and is responsive for all devices and screen sizes
  • The application was tested in the most commonly used browsers (e.g. Chrome, Firefox, Safari)

… platform.

Based on <https://docs.docker.com/build/guide/multi-platform/#platform-build-arguments>
you can use variables like `TARGETARCH` or `TARGETOS` to determine the architecture used in the build command
inside the Dockerfile. This would allow multiarch binary builds for the server.

relates inovex#4339
relates inovex#3994

Signed-off-by: Tim Beermann <[email protected]>
@Lennart01
Copy link
Member

Lennart01 commented Jul 25, 2024

Awesome this should do the trick.
I will merge this into a temp branch and create a new PR so that all our checks can run and we can test it once. 👍.
Tracked in #4363

@Lennart01 Lennart01 changed the base branch from main to hotfix/go_target_arch July 25, 2024 16:43
@Lennart01 Lennart01 merged commit 2d9efc5 into inovex:hotfix/go_target_arch Jul 25, 2024
10 of 12 checks passed
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.

2 participants