diff --git a/Dockerfile b/Dockerfile index f36c9355d75f..e9a73f9e3abd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,7 +13,7 @@ # limitations under the License. # Build the manager binary -FROM golang:1.12.5 as builder +FROM golang:1.12.6 as builder ARG ARCH @@ -22,9 +22,13 @@ WORKDIR ${GOPATH}/src/sigs.k8s.io/cluster-api COPY pkg/ pkg/ COPY cmd/ cmd/ COPY vendor/ vendor/ +COPY go.mod go.mod +COPY go.sum go.sum # Build -RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} go build -a -ldflags '-extldflags "-static"' -o manager sigs.k8s.io/cluster-api/cmd/manager +RUN CGO_ENABLED=0 GOOS=linux GOARCH=${ARCH} GO111MODULE=on GOFLAGS="-mod=vendor" \ + go build -a -ldflags '-extldflags "-static"' \ + -o manager sigs.k8s.io/cluster-api/cmd/manager # Copy the controller-manager into a thin image FROM gcr.io/distroless/static:latest