-
Notifications
You must be signed in to change notification settings - Fork 247
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
Makefile: add multiarch building support #203
Conversation
@marquiz |
I understand the motivation behind this. But, there are some details I don't fully understand, and, I think the current implementation is a bit too hackish. Some quick thoughts and questions:
|
167ac83
to
bf6c489
Compare
@marquiz |
97975fa
to
102a089
Compare
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.
I think the patch could be streamlined still
Dockerfile
Outdated
FROM debian:stretch-slim | ||
FROM BASEIMAGE2 | ||
|
||
CROSS_BUILD_COPY qemu-QEMUARCH-static /usr/bin/ |
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.
Again, could this be commented out, and, QEMUARCH turned into a build arg
Makefile
Outdated
docker run --rm --privileged multiarch/qemu-user-static:register --reset | ||
curl -sSL https://github.com/multiarch/qemu-user-static/releases/download/$(QEMUVERSION)/x86_64_qemu-$(QEMUARCH)-static.tar.gz | tar -xz -C ./ | ||
# Ensure we don't get surprised by umask settings | ||
chmod 0755 qemu-$(QEMUARCH)-static |
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.
Would it be possible to run this inside the Dockerfile, or, put the temporary files in a separate build directory in order to minimize the dirtying of the git work dir?
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.
Done.
I added a new layer in Dockerfile to get the qemu file.
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
5b3a4e3
to
61a6c6f
Compare
@marquiz |
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.
Looks quite good, now, in my eyes. I think we could merge this after resolving the few comments I still have.
I think pulling qemu in a separate image is ok, definitely better than (re-)downloading it with every build.
/remove-lifecycle stale |
Optional, for example. | ||
``` | ||
cd <project-root> | ||
docker run --rm --privileged multiarch/qemu-user-static:register --reset |
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.
Would make pre-cross
be better?
docker run --rm --privileged multiarch/qemu-user-static:register --reset | ||
make image ARCH=arm64 | ||
``` | ||
Or, you can build all supported amd64/non-amd64 images together. |
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.
I'd suggest Or, you can build all supported architectures with one command:
or similar, drop the amd64 here...
docker run --rm --privileged multiarch/qemu-user-static:register --reset | ||
|
||
# Building multi-arch docker images | ||
images-all: pre-cross |
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.
I think pre-cross
should be listed as a phony target, or, removed from here. With the former, we always would run pre-cross
when building images-all
which prolly is ok
@@ -593,6 +593,19 @@ cd <project-root> | |||
make | |||
``` | |||
|
|||
**Build non-amd64 image on amd64:**<br> |
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.
NIT: this just looks a bit clumsy heading 😄
How about Multiarch builds
or Build for target architectures
or smth? If AMD64 is mentioned I think it should be capital case.
Hmm, now my test build fails with:
Need to investigate this. I'd like to be able to run the build myself before merging 😄 |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
I still have issues running What system and docker version are you using to test this on? Could you rebase this PR? /remove-lifecycle stale |
@lubinsz: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
ARG IMAGEARCH | ||
FROM alpine:3.9.2 as qemu | ||
RUN apk add --no-cache curl | ||
ARG QEMUVERSION=2.9.1 |
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.
QEMU version needs to be update
ARG QEMUVERSION=2.9.1 | |
ARG QEMUVERSION=4.1.1-1 |
OK, I think I cracked this one. QEMU version was too old and buggy. Used @lubinsz please rebase and apply that change and I think we can merge this. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Stale issues rot after 30d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
Please rebase /remove-lifecycle rotten |
ping @lubinsz |
Since this PR was opened, Docker has also changed the way in which it does multiarch builds, now preferring the buildx extension, which amongst other things, takes care of wrapping the backing QEMU instances automatically. I suspect much of this could now be simplified by wrapping |
Following up on https://hub.docker.com/repository/docker/adaptant/node-feature-discovery/tags?page=1 The change to the |
Actually, I see that the pstate workaround has already been applied, so it's possible to close this PR. |
Thanks for the investigation and testing. This could be an option if amd64 builds are not affected, not on older docker versions or other builders like podman (or docker ce). If you have time and wish to do so you could open another PR utilising buildx(?) |
As I said, there are no source-level modifications required for buildx - it just works out of the box. The only thing I had to change was the addition of 32-bit ARM support, which was already merged in #322 . I could make a PR that documents it in the README, but to be honest, there is nothing special about its invocation within the NFD context, so the standard buildx instructions are more than sufficient. |
Issues go stale after 90d of inactivity. If this issue is safe to close now please do so with Send feedback to sig-testing, kubernetes/test-infra and/or fejta. |
/close |
@ArangoGutierrez: Closed this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
Signed-off-by: Bin Lu bin.lu@arm.com