-
Notifications
You must be signed in to change notification settings - Fork 154
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
Add multi-arch support for nvidia-device-plugin #422
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,21 @@ | |
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
FROM golang:1.23-bullseye as builder | ||
FROM --platform=$BUILDPLATFORM golang:1.23-bullseye AS builder | ||
|
||
ARG TARGETOS | ||
ARG TARGETARCH | ||
|
||
WORKDIR /go/src/github.com/GoogleCloudPlatform/container-engine-accelerators | ||
COPY . . | ||
RUN go build cmd/nvidia_gpu/nvidia_gpu.go | ||
RUN if [ "${TARGETARCH}" = "arm64" ] && [ "${BUILDARCH}" != "arm64" ]; then \ | ||
apt update && \ | ||
apt install -yq --no-install-recommends \ | ||
gcc-aarch64-linux-gnu libc6-dev-arm64-cross; \ | ||
CC=aarch64-linux-gnu-gcc; \ | ||
fi && \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This dockerfile is used to internally build image for release, also need to double check if the currently louhi pipeline can work successfully after this update. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, currently the Louhi pipeline runs |
||
GOTOOLCHAIN=local GOOS=${TARGETOS} GOARCH=${TARGETARCH} CGO_ENABLED=1 CC=${CC} \ | ||
go build cmd/nvidia_gpu/nvidia_gpu.go | ||
RUN chmod a+x /go/src/github.com/GoogleCloudPlatform/container-engine-accelerators/nvidia_gpu | ||
|
||
FROM gcr.io/distroless/base:latest | ||
|
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.
can we double check the conditions here? Is it assuming the build machine is on X86?
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.
Yes the current build machine is x86. These conditions are ensuring that we only install the cross-compiler if the host machine is x86 AND we are building for arm. It may be a good point to ensure that the host machine is nothing other than x86 or arm though, if that is what you were getting at?