-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
support arm architecture #2803
base: master
Are you sure you want to change the base?
support arm architecture #2803
Conversation
To be able build not only amd64 images we need to support golang downloading for proper architecture. Example: docker buildx build --platform=linux/arm64 -t sameersbn/gitlab .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Short and smart code. I like it. Thank you for your contribution.
For your information:
-
There is a concurrent work Add support to build arm64 image #2732 .
-
From man page of
dpkg-architecture(1)
:In any case, you should never use dpkg --print-architecture to get architecture
information during a package build.What do you think about it? If you plan to use dpkg, the document seems to recommend using
dpkg-architecture -qDEB_HOST_ARCH
. Also, We must ensure that the output ofdpkg-architecture
matches the architecture name used in golang archive filenames.
Thank you for detail answer.
BTW I checked only arm64/amd64 builds. If you are going to support other architectures for all binaries in Dockerfile , for sure we should check golang binaries (and other (!) binaries), for golang list is there https://storage.googleapis.com/golang/, for example I see that |
So I will adjust PR from
to
and that's all. It still will support arm64/amd64, but other architectures should be adjusted additionally (and other binaries, starting from basic ubuntu image architecture list support). |
updated as mentioned, checked by |
Hello, ~$ docker buildx create --use
~$ docker buildx build --platform=linux/amd64,linux/arm64 --cache-from sameersbn/gitlab -t sameersbn/gitlab:16.4.1 . But improvements are needed for the arm, because now it gives an error:
|
So it looks like a need to write patches that update the CGO flags in GoLang to set the reight flags for compilation for arm64 |
|
To be able build not only amd64 images we need to support golang downloading for proper architecture.
Example:
docker buildx build --platform=linux/arm64 -t sameersbn/gitlab .
You can even adjust (in future) your automation builds to push multiarch builds to your docker registries. This is buildkit docker feature OOTB.
Example:
docker buildx build --platform=linux/arm64,linux/arm64 -t <repo tag> --push .
To speedup build you can use previous build as cache
docker buildx build --platform=linux/arm64,linux/arm64 --cache-from <prev build tag> -t <new tag> --push .
and so on.