github.com/kubeflow/training-operator@v1.7.0/build/images/training-operator/Dockerfile (about) 1 # Build the manager binary 2 FROM golang:1.20 as builder 3 4 WORKDIR /workspace 5 # Copy the Go Modules manifests 6 COPY go.mod go.mod 7 COPY go.sum go.sum 8 # cache deps before building and copying source so that we don't need to re-download as much 9 # and so that source changes don't invalidate our downloaded layer 10 RUN go mod download 11 12 # Copy the go source 13 COPY . . 14 15 # Build 16 RUN CGO_ENABLED=0 GOOS=linux GO111MODULE=on go build -a -o manager cmd/training-operator.v1/main.go 17 18 # Use distroless as minimal base image to package the manager binary 19 # Refer to https://github.com/GoogleContainerTools/distroless for more details 20 FROM gcr.io/distroless/static:latest 21 WORKDIR / 22 COPY --from=builder /workspace/manager . 23 ENTRYPOINT ["/manager"]