forked from kubeflow/model-registry
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.dev
45 lines (38 loc) · 1.35 KB
/
Dockerfile.dev
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
43
44
45
# Build the model-registry-storage-initializer binary
# This assumes the root is the model-registry repository
FROM registry.access.redhat.com/ubi8/go-toolset:1.21 AS builder
WORKDIR /modelregistry
# Copy the model-registry Go Modules manifests and sources
COPY go.mod go.mod
COPY go.sum go.sum
COPY cmd/ cmd/
COPY api/ api/
COPY internal/ internal/
COPY scripts/ scripts/
COPY pkg/ pkg/
COPY patches/ patches/
COPY templates/ templates/
USER root
WORKDIR /modelregistry/csi
# Copy the Go Modules manifests
COPY csi/go.mod go.mod
COPY csi/go.sum go.sum
RUN echo "replace github.com/kubeflow/model-registry => ../" >> go.mod
# 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 rest of the source
COPY csi/Makefile Makefile
COPY csi/main.go main.go
COPY csi/pkg/ pkg/
# Build
USER root
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 make build
# Use distroless as minimal base image to package the model-registry storage initializer binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest
WORKDIR /
# copy the storage initializer binary
COPY --from=builder /modelregistry/csi/bin/mr-storage-initializer .
USER 65532:65532
ENTRYPOINT ["/mr-storage-initializer"]