Browse code

Dockerfile: download go libraries before copy vendor

When ever something vendor/ changes the go dependencies have to downloaded again,
which requires internet access and there for is potential slow. COPY and go install is much faster, while the git urls does not change not this often.

Signed-off-by: Jörg Thalheim <joerg@higgsboson.tk>

Jörg Thalheim authored on 2015/04/21 18:33:52
Showing 1 changed files
... ...
@@ -160,20 +160,21 @@ RUN ./contrib/download-frozen-image.sh /docker-frozen-images \
160 160
 	hello-world:frozen@e45a5af57b00862e5ef5782a9925979a02ba2b12dff832fd0991335f4a11e5c5
161 161
 # see also "hack/make/.ensure-frozen-images" (which needs to be updated any time this list is)
162 162
 
163
-# Install man page generator
164
-COPY vendor /go/src/github.com/docker/docker/vendor
165
-# (copy vendor/ because go-md2man needs golang.org/x/net)
163
+# Download man page generator
166 164
 RUN set -x \
167 165
 	&& git clone -b v1.0.1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
168
-	&& git clone -b v1.2 https://github.com/russross/blackfriday.git /go/src/github.com/russross/blackfriday \
169
-	&& go install -v github.com/cpuguy83/go-md2man
166
+	&& git clone -b v1.2 https://github.com/russross/blackfriday.git /go/src/github.com/russross/blackfriday
170 167
 
171
-# install toml validator
168
+# Download toml validator
172 169
 ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
173 170
 RUN set -x \
174 171
 	&& git clone https://github.com/BurntSushi/toml.git /go/src/github.com/BurntSushi/toml \
175
-	&& (cd /go/src/github.com/BurntSushi/toml && git checkout -q $TOMLV_COMMIT) \
176
-	&& go install -v github.com/BurntSushi/toml/cmd/tomlv
172
+	&& (cd /go/src/github.com/BurntSushi/toml && git checkout -q $TOMLV_COMMIT)
173
+
174
+# copy vendor/ because go-md2man needs golang.org/x/net
175
+COPY vendor /go/src/github.com/docker/docker/vendor
176
+RUN go install -v github.com/cpuguy83/go-md2man \
177
+	github.com/BurntSushi/toml/cmd/tomlv
177 178
 
178 179
 # Wrap all commands in the "docker-in-docker" script to allow nested containers
179 180
 ENTRYPOINT ["hack/dind"]