blob: c4ac419532ee51cf8bf8ae6c14cae924002df8ce [file] [log] [blame]
Giorgi Lekveishvilib591eae2023-06-16 12:31:49 +04001# Build the manager binary
2FROM golang:1.18 as builder
3
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +04004ARG TARGETARCH
5
Giorgi Lekveishvilib591eae2023-06-16 12:31:49 +04006WORKDIR /workspace
7# Copy the Go Modules manifests
8COPY go.mod go.mod
9COPY go.sum go.sum
10# cache deps before building and copying source so that we don't need to re-download as much
11# and so that source changes don't invalidate our downloaded layer
12RUN go mod download
13
14# Copy the go source
15COPY main.go main.go
16COPY api/ api/
17COPY controllers/ controllers/
18
19# Build
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +040020RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o manager main.go
Giorgi Lekveishvilib591eae2023-06-16 12:31:49 +040021
22# Use distroless as minimal base image to package the manager binary
23# Refer to https://github.com/GoogleContainerTools/distroless for more details
24FROM gcr.io/distroless/static:nonroot
25WORKDIR /
26COPY --from=builder /workspace/manager .
27USER 65532:65532
28
29ENTRYPOINT ["/manager"]