github.com/oam-dev/cluster-gateway@v1.9.0/cmd/addon-manager/Dockerfile (about) 1 ARG OS=linux 2 ARG ARCH=amd64 3 # Build the manager binary 4 FROM golang:1.20 as builder 5 ARG OS 6 ARG ARCH 7 8 WORKDIR /workspace 9 10 # Copy the Go Modules manifests 11 COPY go.mod go.mod 12 COPY go.sum go.sum 13 # cache deps before building and copying source so that we don't need to re-download as much 14 # and so that source changes don't invalidate our downloaded layer 15 RUN go mod download 16 17 # Copy the go source 18 COPY cmd/ cmd/ 19 COPY pkg/ pkg/ 20 COPY hack/ hack/ 21 22 # Build 23 RUN CGO_ENABLED=0 \ 24 GOOS=${OS} \ 25 GOARCH=${ARCH} \ 26 GO111MODULE=on \ 27 go build \ 28 -a -o addon-manager \ 29 cmd/addon-manager/main.go 30 31 # Use distroless as minimal base image to package the manager binary 32 # Refer to https://github.com/GoogleContainerTools/distroless for more details 33 ARG ARCH 34 FROM multiarch/alpine:${ARCH}-v3.13 35 36 WORKDIR / 37 COPY --from=builder /workspace/addon-manager / 38 39 ENTRYPOINT ["/addon-manager"]