From 29d77acaf8bfb234ee4f0b3db9e28d7410b99d4e Mon Sep 17 00:00:00 2001 From: Sebastiaan van Stijn Date: Fri, 8 Dec 2017 14:02:32 -0800 Subject: [PATCH] Update go-swagger installation steps in Dockerfile MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- Dockerfile | 9 ++++++--- Dockerfile.aarch64 | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5f78eda682..b6d32481b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -145,9 +145,12 @@ RUN pip install yamllint==1.5.0 # Install go-swagger for validating swagger.yaml ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb -RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \ - && (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \ - && go install -v github.com/go-swagger/go-swagger/cmd/swagger +RUN set -x \ + && export GOPATH="$(mktemp -d)" \ + && git clone https://github.com/go-swagger/go-swagger.git "$GOPATH/src/github.com/go-swagger/go-swagger" \ + && (cd "$GOPATH/src/github.com/go-swagger/go-swagger" && git checkout -q "$GO_SWAGGER_COMMIT") \ + && go build -o /usr/local/bin/swagger github.com/go-swagger/go-swagger/cmd/swagger \ + && rm -rf "$GOPATH" # Set user.email so crosbymichael's in-container merge commits go smoothly RUN git config --global user.email 'docker-dummy@example.com' diff --git a/Dockerfile.aarch64 b/Dockerfile.aarch64 index 58ca40d878..4a54cd391f 100644 --- a/Dockerfile.aarch64 +++ b/Dockerfile.aarch64 @@ -118,9 +118,12 @@ RUN pip install yamllint==1.5.0 # Install go-swagger for validating swagger.yaml ENV GO_SWAGGER_COMMIT c28258affb0b6251755d92489ef685af8d4ff3eb -RUN git clone https://github.com/go-swagger/go-swagger.git /go/src/github.com/go-swagger/go-swagger \ - && (cd /go/src/github.com/go-swagger/go-swagger && git checkout -q $GO_SWAGGER_COMMIT) \ - && go install -v github.com/go-swagger/go-swagger/cmd/swagger +RUN set -x \ + && export GOPATH="$(mktemp -d)" \ + && git clone https://github.com/go-swagger/go-swagger.git "$GOPATH/src/github.com/go-swagger/go-swagger" \ + && (cd "$GOPATH/src/github.com/go-swagger/go-swagger" && git checkout -q "$GO_SWAGGER_COMMIT") \ + && go build -o /usr/local/bin/swagger github.com/go-swagger/go-swagger/cmd/swagger \ + && rm -rf "$GOPATH" # Set user.email so crosbymichael's in-container merge commits go smoothly RUN git config --global user.email 'docker-dummy@example.com'