浏览代码

Update protoc compiler in Docker image and make it smaller

Pierre Massat 7 年之前
父节点
当前提交
4904e4567f
共有 1 个文件被更改,包括 15 次插入12 次删除
  1. 15 12
      Docker/Dockerfile

+ 15 - 12
Docker/Dockerfile

@@ -1,19 +1,22 @@
-FROM swiftdocker/swift:latest
+FROM swift:latest
 MAINTAINER Tim Burks <timburks@google.com>
 
+ENV PROTOC_VERSION=3.5.1
+
 # Install a few needed packages that aren't in swiftdocker/swift
-RUN apt-get -q update && \
-    apt-get -q install -y libz-dev && \
-    apt-get -q install -y unzip 
+RUN apt-get -q update \
+    && apt-get -q install -y unzip \
+    && rm -r /var/lib/apt/lists/*
 
 # Install protoc
-RUN curl -O -L https://github.com/google/protobuf/releases/download/v3.4.0/protoc-3.4.0-linux-x86_64.zip && \
-    unzip protoc-3.4.0-linux-x86_64.zip -d /usr
+RUN curl -O -L https://github.com/google/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip \
+    && unzip protoc-${PROTOC_VERSION}-linux-x86_64.zip -d /usr \
+    && rm -rf protoc-${PROTOC_VERSION}-linux-x86_64.zip
 
 # Build and install the swiftgrpc plugin
-RUN git clone https://github.com/grpc/grpc-swift && \
-    cd grpc-swift/Plugin && \
-    make && \
-    cp protoc-gen-swift /usr/bin && \
-    cp protoc-gen-swiftgrpc /usr/bin 
-
+RUN git clone https://github.com/grpc/grpc-swift \
+    && cd grpc-swift/Plugin \
+    && make \
+    && cp protoc-gen-swift protoc-gen-swiftgrpc /usr/bin \
+    && cd / \
+    && rm -rf grpc-swift