Improve caching behavior of controller/Dockerfile.
Precompiling pkg/ in an earlier layer saves ~10 seconds of wall clock
time on an incremental build on my machine (i9-7960x) when I update a
file in controller/ such as controller/destination/server.go. This
makes a significant difference in the edit-build-test loop.
FROM gcr.io/runconduit/go-deps:749453c2 as golang
ARG CONDUIT_VERSION
WORKDIR /go/src/github.com/runconduit/conduit
-COPY controller controller
+COPY controller/gen controller/gen
COPY pkg pkg
+RUN CGO_ENABLED=0 GOOS=linux go install -installsuffix cgo -ldflags "-X github.com/runconduit/conduit/pkg/version.Version=$CONDUIT_VERSION" ./pkg/...
+COPY controller controller
# use `install` so that we produce multiple binaries
-RUN CGO_ENABLED=0 GOOS=linux go install -a -installsuffix cgo -ldflags "-X github.com/runconduit/conduit/pkg/version.Version=$CONDUIT_VERSION" ./controller/cmd/...
+RUN CGO_ENABLED=0 GOOS=linux go install -installsuffix cgo -ldflags "-X github.com/runconduit/conduit/pkg/version.Version=$CONDUIT_VERSION" ./controller/cmd/...
## package runtime
FROM gcr.io/runconduit/base:2017-10-30.01
