blob: b549ffe97290316c01c3e8c3663a51b9d99d910e [file] [log] [blame]
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +04001# # Build the manager binary
2# FROM golang:1.18 as builder
Giorgi Lekveishvili7366dbb2023-06-16 12:31:03 +04003
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +04004# WORKDIR /workspace
5# # Copy the Go Modules manifests
6# COPY go.mod go.mod
7# COPY go.sum go.sum
8# # cache deps before building and copying source so that we don't need to re-download as much
9# # and so that source changes don't invalidate our downloaded layer
10# RUN go mod download
Giorgi Lekveishvili7366dbb2023-06-16 12:31:03 +040011
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +040012# # Copy the go source
13# COPY main.go main.go
14# COPY api/ api/
15# COPY controllers/ controllers/
Giorgi Lekveishvili7366dbb2023-06-16 12:31:03 +040016
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +040017# # Build
18# RUN CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -a -o manager main.go
Giorgi Lekveishvili7366dbb2023-06-16 12:31:03 +040019
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +040020# # Use distroless as minimal base image to package the manager binary
21# # Refer to https://github.com/GoogleContainerTools/distroless for more details
Giorgi Lekveishvili7366dbb2023-06-16 12:31:03 +040022FROM gcr.io/distroless/static:nonroot
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +040023ARG TARGETARCH
Giorgi Lekveishvili7366dbb2023-06-16 12:31:03 +040024WORKDIR /
Giorgi Lekveishvili2d843c32023-07-20 10:10:24 +040025COPY manager_${TARGETARCH} manager
Giorgi Lekveishvili7366dbb2023-06-16 12:31:03 +040026USER 65532:65532
27
28ENTRYPOINT ["/manager"]