blob: 5f6e3958bab1fec4e025691d5ce2bb5cca5f582e [file] [log] [blame]
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +04001# # Build the manager binary
2# FROM golang:1.18 as builder
Giorgi Lekveishvilib591eae2023-06-16 12:31:49 +04003
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +04004# ARG TARGETARCH
Giorgi Lekveishvili0ccd1482023-06-21 15:02:24 +04005
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +04006# WORKDIR /workspace
7# # Copy the Go Modules manifests
8# COPY go.mod go.mod
9# COPY 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
12# RUN go mod download
Giorgi Lekveishvilib591eae2023-06-16 12:31:49 +040013
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +040014# # Copy the go source
15# COPY main.go main.go
16# COPY api/ api/
17# COPY controllers/ controllers/
Giorgi Lekveishvilib591eae2023-06-16 12:31:49 +040018
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +040019# # Build
20# RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o manager main.go
Giorgi Lekveishvilib591eae2023-06-16 12:31:49 +040021
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +040022# # Use distroless as minimal base image to package the manager binary
23# # Refer to https://github.com/GoogleContainerTools/distroless for more details
Giorgi Lekveishvilib591eae2023-06-16 12:31:49 +040024FROM gcr.io/distroless/static:nonroot
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +040025ARG TARGETARCH
Giorgi Lekveishvilib591eae2023-06-16 12:31:49 +040026WORKDIR /
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +040027COPY manager_${TARGETARCH} manager
Giorgi Lekveishvilib591eae2023-06-16 12:31:49 +040028USER 65532:65532
29
30ENTRYPOINT ["/manager"]