Skip to content

Commit

Permalink
Dockerfile: simplify procobuf install
Browse files Browse the repository at this point in the history
Use unzip options to unpack directly to /usr/local/{include,bin},
to avoid unnecessary I/O.

Unfortunately unzip does not support unpacking from a pipe (due
to a limitation of .zip format -- the index is at EOF) so we still
have to save the .zip to disk, read it back, and remove. If they
could only provide tarballs... *sigh*

Signed-off-by: Kir Kolyshkin <[email protected]>
  • Loading branch information
kolyshkin authored and olljanat committed Sep 29, 2018
1 parent e6a2a25 commit 37db054
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,12 @@ FROM golang:1.11.0-stretch
RUN apt-get update && apt-get install -y make git unzip

# should stay consistent with the version we use in Circle builds
ARG PROTOC_VERSION=3.5.0
# make a directory to do these operations in
RUN export PROTOC_TMP_DIR=protoc && mkdir -p $PROTOC_TMP_DIR && cd $PROTOC_TMP_DIR \
# download the pre-built protoc binary
&& curl --silent --show-error --location --output protoc.zip \
https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip \
# move the binary to /bin. move the well-known types ot /usr/local/include
&& unzip protoc.zip && mv bin/protoc /bin/protoc && mv include/* /usr/local/include \
# remove all of the installation files
&& cd .. && rm -rf $PROTOC_TMP_DIR
ARG PROTOC_VERSION=3.6.1
# download and install protoc binary and .proto files
RUN curl --silent --show-error --location --output protoc.zip \
https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/protoc-$PROTOC_VERSION-linux-x86_64.zip \
&& unzip -d /usr/local protoc.zip include/\* bin\/* \
&& rm -f protoc.zip

WORKDIR /go/src/github.com/docker/swarmkit/

Expand Down

0 comments on commit 37db054

Please sign in to comment.