# Build the manager binary FROM docker.io/library/golang:1.19 as builder WORKDIR /workspace # Copy the Go Modules manifests COPY go.mod go.mod COPY go.sum go.sum # Copy dependencies COPY vendor/ vendor/ # Copy the go source COPY cmd/ cmd/ COPY pkg/ pkg/ # Build RUN CGO_ENABLED=0 go build -a -v -tags netgo -o pod-cleaner ./cmd/pod-cleaner # 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:nonroot WORKDIR / COPY --from=builder /workspace/pod-cleaner . USER 65532:65532 ENTRYPOINT ["/pod-cleaner"]