-
Notifications
You must be signed in to change notification settings - Fork 3
/
Dockerfile
33 lines (25 loc) · 971 Bytes
/
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
# Build the manager binary
FROM golang:1.23 as builder
ENV os "linux"
ENV arch "amd64"
COPY . /workspace
WORKDIR /workspace
#RUN useradd -d /home/appuser -m -s /bin/bash appuser
#USER appuser
# download kubebuilder
RUN mkdir -p /usr/local/kubebuilder
RUN make kubebuilder
# 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
# Run tests
RUN make test
# Build
RUN CGO_ENABLED=0 GOOS=${os} GOARCH=${arch} GO111MODULE=on go build -a -installsuffix cgo -o digdirator cmd/digdirator/main.go
# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
FROM gcr.io/distroless/static-debian12:nonroot
WORKDIR /
COPY --from=builder /workspace/digdirator /digdirator
# HEALTHCHECK CMD curl --fail http://localhost:8080/metrics/ || exit 1
CMD ["/digdirator"]