-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
49 lines (34 loc) · 1.27 KB
/
Dockerfile
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
46
47
48
49
# DO NOT EDIT! This file is generated by 'hack/gen-dockerfile.sh' from 'Dockerfile.in'
#
# BUILDER
#
FROM docker.io/library/golang:1.22 AS builder
WORKDIR /buildroot
# 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.
COPY client/ client/
COPY proto/ proto/
COPY internal/ internal/
COPY controller/go.mod controller/go.mod
COPY controller/go.sum controller/go.sum
WORKDIR /buildroot/controller
RUN go mod download
WORKDIR /buildroot
COPY controller/cmd/ controller/cmd/
COPY controller/pkg/ controller/pkg/
WORKDIR /buildroot/controller
RUN CGO_ENABLED=0 go build -o /buildroot/artifacts/controller cmd/*.go
#
# FINAL IMAGE
#
FROM gcr.io/distroless/static:nonroot
LABEL maintainers="Kubernetes Authors"
LABEL description="COSI controller"
LABEL org.opencontainers.image.title="COSI controller"
LABEL org.opencontainers.image.description="Container Object Storage Interface (COSI) controller"
LABEL org.opencontainers.image.source="https://github.com/kubernetes-sigs/container-object-storage-interface-api/controller"
LABEL org.opencontainers.image.licenses="APACHE-2.0"
WORKDIR /
COPY --from=builder /buildroot/artifacts/controller .
USER 65532:65532
ENTRYPOINT ["/controller"]