The installation steps for go-swagger was a bit noisy, and not consistent with
other installation steps.
This patch makes it similar to other steps, which makes it less noisy, and
makes the image slightly smaller.
Before:
b53d7aac3200 14 minutes ago |1 APT_MIRROR=deb.debian.org /bin/sh -c git … 107MB
fa74acf32f99 2 hours ago /bin/sh -c #(nop) ENV GO_SWAGGER_COMMIT=c28… 0B
After:
6b2454f1a9a5 10 minutes ago |1 APT_MIRROR=deb.debian.org /bin/sh -c set … 35.2MB
fa74acf32f99 2 hours ago /bin/sh -c #(nop) ENV GO_SWAGGER_COMMIT=c28… 0B
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
| ... | ... |
@@ -145,9 +145,12 @@ RUN pip install yamllint==1.5.0 |
| 145 | 145 |
|
| 146 | 146 |
# Install go-swagger for validating swagger.yaml |
| 147 | 147 |
ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb |
| 148 |
-RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \ |
|
| 149 |
- && (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \ |
|
| 150 |
- && go install -v github.com/go-swagger/go-swagger/cmd/swagger |
|
| 148 |
+RUN set -x \ |
|
| 149 |
+ && export GOPATH="$(mktemp -d)" \ |
|
| 150 |
+ && git clone https://github.com/go-swagger/go-swagger.git "$GOPATH/src/github.com/go-swagger/go-swagger" \ |
|
| 151 |
+ && (cd "$GOPATH/src/github.com/go-swagger/go-swagger" && git checkout -q "$GO_SWAGGER_COMMIT") \ |
|
| 152 |
+ && go build -o /usr/local/bin/swagger github.com/go-swagger/go-swagger/cmd/swagger \ |
|
| 153 |
+ && rm -rf "$GOPATH" |
|
| 151 | 154 |
|
| 152 | 155 |
# Set user.email so crosbymichael's in-container merge commits go smoothly |
| 153 | 156 |
RUN git config --global user.email 'docker-dummy@example.com' |
| ... | ... |
@@ -118,9 +118,12 @@ RUN pip install yamllint==1.5.0 |
| 118 | 118 |
|
| 119 | 119 |
# Install go-swagger for validating swagger.yaml |
| 120 | 120 |
ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb |
| 121 |
-RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \ |
|
| 122 |
- && (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \ |
|
| 123 |
- && go install -v github.com/go-swagger/go-swagger/cmd/swagger |
|
| 121 |
+RUN set -x \ |
|
| 122 |
+ && export GOPATH="$(mktemp -d)" \ |
|
| 123 |
+ && git clone https://github.com/go-swagger/go-swagger.git "$GOPATH/src/github.com/go-swagger/go-swagger" \ |
|
| 124 |
+ && (cd "$GOPATH/src/github.com/go-swagger/go-swagger" && git checkout -q "$GO_SWAGGER_COMMIT") \ |
|
| 125 |
+ && go build -o /usr/local/bin/swagger github.com/go-swagger/go-swagger/cmd/swagger \ |
|
| 126 |
+ && rm -rf "$GOPATH" |
|
| 124 | 127 |
|
| 125 | 128 |
# Set user.email so crosbymichael's in-container merge commits go smoothly |
| 126 | 129 |
RUN git config --global user.email 'docker-dummy@example.com' |