Repository navigation
Expand file tree
/
Copy pathContainerfile.server
More file actions
42 lines (33 loc) · 1.51 KB
/
Copy pathContainerfile.server
File metadata and controls
42 lines (33 loc) · 1.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Build the model-serving-api binary
FROM registry.access.redhat.com/ubi9/go-toolset:1.25@sha256:8c5aeac74b4b60dc2e5e44f6b639186b7ec2fec8f0eb9a36d4a32dcf8e255f52 AS builder
# These built-in args are defined in the global scope, and are not automatically
# accessible within build stages or RUN commands.
# To expose these arguments inside the build stage, we need to redefine it without a value.
ARG TARGETOS TARGETARCH
RUN echo "GOOS=${TARGETOS} GOARCH=${TARGETARCH}"
WORKDIR /go/src/github.com/opendatahub-io/odh-model-controller
# Copy the Go Modules manifests
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
# Copy the go source
COPY server/ server/
# Build
USER root
RUN CGO_ENABLED=1 GOOS=${TARGETOS} GOARCH=${TARGETARCH} GOFLAGS=-mod=mod \
GOEXPERIMENT=strictfipsruntime \
go build -tags strictfipsruntime -a -o model-serving-api ./server/
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
RUN microdnf install -y --disablerepo=* --enablerepo=ubi-9-baseos-rpms shadow-utils && \
useradd model-serving-api -m -u 1000 && \
microdnf remove -y shadow-utils && \
microdnf clean all
COPY --from=builder /go/src/github.com/opendatahub-io/odh-model-controller/model-serving-api /
USER 1000:1000
ENTRYPOINT ["/model-serving-api"]
LABEL com.redhat.component="odh-model-serving-api" \
name="odh-model-serving-api" \
description="odh-model-serving-api" \
summary="odh-model-serving-api" \
io.k8s.display-name="odh-model-serving-api" \
io.k8s.description="odh-model-serving-api"