Browse code

Merge pull request #35749 from thaJeztah/change-swagger-install

Update go-swagger installation steps in Dockerfile

Vincent Demeester authored on 2018/02/14 16:20:06
Showing 2 changed files
... ...
@@ -146,9 +146,12 @@ RUN pip install yamllint==1.5.0
146 146
 
147 147
 # Install go-swagger for validating swagger.yaml
148 148
 ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb
149
-RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \
150
-	&& (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \
151
-	&& go install -v github.com/go-swagger/go-swagger/cmd/swagger
149
+RUN set -x \
150
+	&& export GOPATH="$(mktemp -d)" \
151
+	&& git clone https://github.com/go-swagger/go-swagger.git "$GOPATH/src/github.com/go-swagger/go-swagger" \
152
+	&& (cd "$GOPATH/src/github.com/go-swagger/go-swagger" && git checkout -q "$GO_SWAGGER_COMMIT") \
153
+	&& go build -o /usr/local/bin/swagger github.com/go-swagger/go-swagger/cmd/swagger \
154
+	&& rm -rf "$GOPATH"
152 155
 
153 156
 # Set user.email so crosbymichael's in-container merge commits go smoothly
154 157
 RUN git config --global user.email 'docker-dummy@example.com'
... ...
@@ -119,9 +119,12 @@ RUN pip install yamllint==1.5.0
119 119
 
120 120
 # Install go-swagger for validating swagger.yaml
121 121
 ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb
122
-RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \
123
-	&& (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \
124
-	&& go install -v github.com/go-swagger/go-swagger/cmd/swagger
122
+RUN set -x \
123
+	&& export GOPATH="$(mktemp -d)" \
124
+	&& git clone https://github.com/go-swagger/go-swagger.git "$GOPATH/src/github.com/go-swagger/go-swagger" \
125
+	&& (cd "$GOPATH/src/github.com/go-swagger/go-swagger" && git checkout -q "$GO_SWAGGER_COMMIT") \
126
+	&& go build -o /usr/local/bin/swagger github.com/go-swagger/go-swagger/cmd/swagger \
127
+	&& rm -rf "$GOPATH"
125 128
 
126 129
 # Set user.email so crosbymichael's in-container merge commits go smoothly
127 130
 RUN git config --global user.email 'docker-dummy@example.com'