35 lines
1016 B
Docker
35 lines
1016 B
Docker
# Build the model-registry binary
|
|
FROM registry.access.redhat.com/ubi8/go-toolset:1.24.4 AS builder
|
|
|
|
WORKDIR /workspace
|
|
# Copy the Go Modules manifests
|
|
COPY ["go.mod", "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
|
|
|
|
USER root
|
|
|
|
# Copy the go source
|
|
COPY ["Makefile", "main.go", ".openapi-generator-ignore", "openapitools.json", "./"]
|
|
|
|
# Copy rest of the source
|
|
COPY bin/ bin/
|
|
COPY cmd/ cmd/
|
|
COPY api/ api/
|
|
COPY internal/ internal/
|
|
COPY pkg/ pkg/
|
|
|
|
# Build
|
|
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 make clean/odh build/odh
|
|
|
|
# Use distroless as minimal base image to package the model-registry binary
|
|
# Refer to https://github.com/GoogleContainerTools/distroless for more details
|
|
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
|
|
WORKDIR /
|
|
# copy the registry binary
|
|
COPY --from=builder /workspace/model-registry .
|
|
USER 65532:65532
|
|
|
|
ENTRYPOINT ["/model-registry"]
|