From 20c6ede9f8c7c629a4ee1d102b9f5975aa3284b6 Mon Sep 17 00:00:00 2001 From: Kevin Date: Thu, 23 May 2024 11:57:34 -0400 Subject: [PATCH] CARRY: add separate file for RHOAI build and update multarch base image Signed-off-by: Kevin --- .../training-operator/Dockerfile.multiarch | 2 +- .../images/training-operator/Dockerfile.rhoai | 25 +++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 build/images/training-operator/Dockerfile.rhoai diff --git a/build/images/training-operator/Dockerfile.multiarch b/build/images/training-operator/Dockerfile.multiarch index 35efc9cbbd..333fe5f08e 100644 --- a/build/images/training-operator/Dockerfile.multiarch +++ b/build/images/training-operator/Dockerfile.multiarch @@ -1,4 +1,4 @@ -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9 +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest ARG TARGETARCH WORKDIR / COPY ./manager-${TARGETARCH} ./manager diff --git a/build/images/training-operator/Dockerfile.rhoai b/build/images/training-operator/Dockerfile.rhoai new file mode 100644 index 0000000000..e0d27ca91c --- /dev/null +++ b/build/images/training-operator/Dockerfile.rhoai @@ -0,0 +1,25 @@ +# Build the manager binary +FROM registry.access.redhat.com/ubi9/go-toolset:1.20.10 as builder + +WORKDIR /workspace +# Copy the Go Modules manifests +COPY go.mod go.mod +COPY go.sum go.sum +# cache deps before building and copying source so that we don't need to re-download as much +# and so that source changes don't invalidate our downloaded layer +RUN go mod download + +# Copy the go source +COPY . . + +# Build +USER root +RUN CGO_ENABLED=1 GOOS=linux GO111MODULE=on go build -tags strictfipsruntime -a -o manager cmd/training-operator.v1/main.go + +# Use distroless as minimal base image to package the manager binary +# Refer to https://github.com/GoogleContainerTools/distroless for more details +FROM registry.access.redhat.com/ubi9/ubi-minimal:latest +WORKDIR / +COPY --from=builder /workspace/manager . +USER 65532:65532 +ENTRYPOINT ["/manager"]