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"]