Browse code

Adjust "Dockerfile" to build tools we need in isolated mktemp GOPATHs

Signed-off-by: Andrew "Tianon" Page <admwiggin@gmail.com>

Tianon Gravi authored on 2015/06/06 07:20:04
Showing 1 changed files
... ...
@@ -123,11 +123,12 @@ RUN gem install --no-rdoc --no-ri fpm --version 1.3.2
123 123
 # Install registry
124 124
 ENV REGISTRY_COMMIT d957768537c5af40e4f4cd96871f7b2bde9e2923
125 125
 RUN set -x \
126
-	&& git clone https://github.com/docker/distribution.git /go/src/github.com/docker/distribution \
127
-	&& (cd /go/src/github.com/docker/distribution && git checkout -q $REGISTRY_COMMIT) \
128
-	&& GOPATH=/go/src/github.com/docker/distribution/Godeps/_workspace:/go \
129
-		go build -o /go/bin/registry-v2 github.com/docker/distribution/cmd/registry \
130
-	&& rm -rf /go/src/github.com/docker/distribution/
126
+	&& export GOPATH="$(mktemp -d)" \
127
+	&& git clone https://github.com/docker/distribution.git "$GOPATH/src/github.com/docker/distribution" \
128
+	&& (cd "$GOPATH/src/github.com/docker/distribution" && git checkout -q "$REGISTRY_COMMIT") \
129
+	&& GOPATH="$GOPATH/src/github.com/docker/distribution/Godeps/_workspace:$GOPATH" \
130
+		go build -o /usr/local/bin/registry-v2 github.com/docker/distribution/cmd/registry \
131
+	&& rm -rf "$GOPATH"
131 132
 
132 133
 # Get the "docker-py" source so we can run their integration tests
133 134
 ENV DOCKER_PY_COMMIT 91985b239764fe54714fa0a93d52aa362357d251
... ...
@@ -169,19 +170,21 @@ RUN ./contrib/download-frozen-image.sh /docker-frozen-images \
169 169
 
170 170
 # Download man page generator
171 171
 RUN set -x \
172
-	&& git clone -b v1.0.1 https://github.com/cpuguy83/go-md2man.git /go/src/github.com/cpuguy83/go-md2man \
173
-	&& git clone -b v1.2 https://github.com/russross/blackfriday.git /go/src/github.com/russross/blackfriday
172
+	&& export GOPATH="$(mktemp -d)" \
173
+	&& git clone -b v1.0.1 https://github.com/cpuguy83/go-md2man.git "$GOPATH/src/github.com/cpuguy83/go-md2man" \
174
+	&& git clone -b v1.2 https://github.com/russross/blackfriday.git "$GOPATH/src/github.com/russross/blackfriday" \
175
+	&& go get -v -d github.com/cpuguy83/go-md2man \
176
+	&& go build -v -o /usr/local/bin/go-md2man github.com/cpuguy83/go-md2man \
177
+	&& rm -rf "$GOPATH"
174 178
 
175 179
 # Download toml validator
176 180
 ENV TOMLV_COMMIT 9baf8a8a9f2ed20a8e54160840c492f937eeaf9a
177 181
 RUN set -x \
178
-	&& git clone https://github.com/BurntSushi/toml.git /go/src/github.com/BurntSushi/toml \
179
-	&& (cd /go/src/github.com/BurntSushi/toml && git checkout -q $TOMLV_COMMIT)
180
-
181
-# copy vendor/ because go-md2man needs golang.org/x/net
182
-COPY vendor /go/src/github.com/docker/docker/vendor
183
-RUN go install -v github.com/cpuguy83/go-md2man \
184
-	github.com/BurntSushi/toml/cmd/tomlv
182
+	&& export GOPATH="$(mktemp -d)" \
183
+	&& git clone https://github.com/BurntSushi/toml.git "$GOPATH/src/github.com/BurntSushi/toml" \
184
+	&& (cd "$GOPATH/src/github.com/BurntSushi/toml" && git checkout -q "$TOMLV_COMMIT") \
185
+	&& go build -v -o /usr/local/bin/tomlv github.com/BurntSushi/toml/cmd/tomlv \
186
+	&& rm -rf "$GOPATH"
185 187
 
186 188
 # Build/install the tool for embedding resources in Windows binaries
187 189
 ENV RSRC_COMMIT e48dbf1b7fc464a9e85fcec450dddf80816b76e0