ARG golang_image FROM $golang_image WORKDIR /go/src/github.com/aws/amazon-vpc-cni-k8s # Force the go compiler to use modules. ENV GO111MODULE=on ENV GOPROXY=direct # Add goimports RUN go install golang.org/x/tools/cmd/goimports@latest # go.mod and go.sum go into their own layers. COPY go.mod . COPY go.sum . # This ensures `go mod download` happens only when go.mod and go.sum change. RUN go mod download COPY . .