github.com/argoproj-labs/argocd-operator@v0.10.0/Dockerfile (about) 1 # Build the manager binary 2 FROM golang:1.21 as builder 3 4 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 11 12 # Copy the go source 13 COPY main.go main.go 14 COPY api/ api/ 15 COPY common/ common/ 16 COPY controllers/ controllers/ 17 COPY version/ version/ 18 19 # Build 20 ARG LD_FLAGS 21 RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="$LD_FLAGS" -a -o manager main.go 22 23 # Use distroless as minimal base image to package the manager binary 24 # Refer to https://github.com/GoogleContainerTools/distroless for more details 25 FROM gcr.io/distroless/static:nonroot 26 WORKDIR / 27 COPY --from=builder /workspace/manager . 28 29 # install redis artifacts 30 COPY build/redis /var/lib/redis 31 32 USER 65532:65532 33 34 ENTRYPOINT ["/manager"]