forked from opendatahub-io/kserve
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathagent.Dockerfile
More file actions
40 lines (29 loc) · 1.26 KB
/
agent.Dockerfile
File metadata and controls
40 lines (29 loc) · 1.26 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
# Build the inference-agent binary
FROM registry.access.redhat.com/ubi9/go-toolset:1.25 AS builder
# Copy in the go src
WORKDIR /go/src/github.com/kserve/kserve
COPY go.mod go.mod
COPY go.sum go.sum
RUN go mod download
COPY cmd/ cmd/
COPY pkg/ pkg/
# Build
USER root
RUN CGO_ENABLED=0 GOOS=linux GOFLAGS=-mod=mod go build -a -o agent ./cmd/agent
# Generate third-party licenses
COPY LICENSE LICENSE
RUN go install github.com/google/go-licenses@latest
# Forbidden Licenses: https://github.com/google/licenseclassifier/blob/e6a9bb99b5a6f71d5a34336b8245e305f5430f99/license_type.go#L341
RUN /opt/app-root/src/go/bin/go-licenses check ./cmd/... ./pkg/... --disallowed_types="forbidden,unknown"
RUN /opt/app-root/src/go/bin/go-licenses save --save_path third_party/library ./cmd/agent
# Copy the inference-agent into a thin image
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest
RUN microdnf install -y --disablerepo=* --enablerepo=ubi-9-baseos-rpms shadow-utils && \
microdnf clean all && \
useradd kserve -m -u 1000
RUN microdnf remove -y shadow-utils
COPY --from=builder /go/src/github.com/kserve/kserve/third_party /third_party
WORKDIR /ko-app
COPY --from=builder /go/src/github.com/kserve/kserve/agent /ko-app/
USER 1000:1000
ENTRYPOINT ["/ko-app/agent"]