I have a Dockerfile which is FROM golang:1.6-alpine
. I’d like to use the docker images cache as much as possible while performing docker build
to speed things up.
For this, I thought I’d add ADD vendor /go/src/…/mypackage/vendor
as one of the first steps, and eventually run go install -v …/mypackage
. However, this causes the vendored packages (which are the bulk of the build time) to only be built then.
Is there anyway to explicitly build all vendored packages (i.e. sources inside a …/vendor
dir), but only them?
I'd like my Dockerfile to look something like this:
FROM golang:1.6-alpine
ADD vendor /go/src/github.com/myuser/package/vendor
# missing: magic command to build only the vendored packages above
ADD *.go /go/src/github.com/myuser/package
RUN go install -v "github.com/myuser/package