forked from opendatahub-io/training-operator
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Review Dockerfile file for building odh-training-operator in konflux
- Loading branch information
1 parent
4b4e3bb
commit 33ad099
Showing
1 changed file
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
ARG SOURCE_CODE=. | ||
ARG CI_CONTAINER_VERSION="unknown" | ||
FROM registry.access.redhat.com/ubi8/go-toolset@sha256:4ec05fd5b355106cc0d990021a05b71bbfb9231e4f5bdc0c5316515edf6a1c96 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.redhat.io/ubi8/ubi-minimal:latest AS runtime | ||
|
||
ARG CI_CONTAINER_VERSION | ||
ARG USER=65532 | ||
|
||
LABEL com.redhat.component="odh-training-operator-container" \ | ||
name="managed-open-data-hub/odh-training-operator-rhel8" \ | ||
version="${CI_CONTAINER_VERSION}" \ | ||
git.url="${CI_TRAINING_OPERATOR_UPSTREAM_URL}" \ | ||
git.commit="${CI_TRAINING_OPERATOR_UPSTREAM_COMMIT}" \ | ||
summary="odh-training-operator" \ | ||
io.openshift.expose-services="" \ | ||
io.k8s.display-name="odh-training-operator" \ | ||
maintainer="['[email protected]']" \ | ||
description="Training Operator is a Kubernetes-native project for fine-tuning and scalable distributed training of AI/ML models created with various frameworks such as PyTorch." \ | ||
com.redhat.license_terms="https://www.redhat.com/licenses/Red_Hat_Standard_EULA_20191108.pdf" | ||
WORKDIR / | ||
COPY --from=builder /workspace/manager . | ||
## Create a non-root user with UID 65532 and switch to it | ||
USER ${USER}:${USER} | ||
ENTRYPOINT ["/manager"] |