Merge pull request #1703 from pulumi/joeduffy/protobufc_dockerfile

Make Protobuf/gRPC compilation repeatable
This commit is contained in:
Joe Duffy 2018-08-04 20:30:23 -07:00 committed by GitHub
commit 8dca3f7b48
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 7 deletions

View file

@ -20,7 +20,6 @@ TEST_FAST_TIMEOUT := 2m
endif
build-proto::
docker build -t pulumi/protobuf-builder sdk/proto
cd sdk/proto && ./generate.sh
build::

View file

@ -12,10 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
FROM ubuntu
FROM node:8
RUN apt-get update
RUN apt-get install -y curl unzip golang git npm python-pip
RUN apt-get install -y curl unzip golang git python-pip python-dev
RUN pip install --upgrade pip
# Install `protoc` v3.5.1.
RUN curl -OL https://github.com/google/protobuf/releases/download/v3.5.1/protoc-3.5.1-linux-x86_64.zip
@ -37,8 +38,9 @@ RUN git checkout v1.1.0
RUN go install ./protoc-gen-go
# Install node gRPC tools.
RUN npm install -g grpc
RUN npm install -g grpc-tools
RUN ln -s /usr/bin/nodejs /usr/bin/node
RUN npm install -g grpc --unsafe-perm
RUN npm install -g grpc-tools --unsafe-perm
# Install Python gRPC tools.
RUN python -m pip install grpcio grpcio-tools

View file

@ -10,6 +10,10 @@
# different langauges, so nothing is else required to be installed on your machine.
set -e
# First build our Protobuf/gRPC compiler Docker image, so dev machines don't need it.
echo "* Building Protobuf/gRPC compilers:"
docker build -t pulumi/protobuf-builder .
DOCKER_RUN="docker run -it --rm -v $(pwd)/../python:/python -v $(pwd)/../nodejs:/nodejs -v $(pwd):/local pulumi/protobuf-builder"
PROTOC="$DOCKER_RUN protoc"
@ -20,7 +24,7 @@ PROTOC="$DOCKER_RUN protoc"
PROTO_FILES=$(find . -name "*.proto" -not -name "status.proto")
JS_PROTO_FILES=$(find . -name "*.proto")
echo Generating Protobuf/gRPC SDK files:
echo "* Generating Protobuf/gRPC SDK files:"
echo -e "\tVERSION: $($PROTOC --version)"
echo -e "Generated by version $($PROTOC --version) of protoc" > ./grpc_version.txt
@ -60,4 +64,4 @@ $DOCKER_RUN /bin/bash -c 'PY_PULUMIRPC=/python/lib/pulumi/runtime/proto/ && \
sed -i "s/^import \([^ ]*\)_pb2 as \([^ ]*\)$/from . import \1_pb2 as \2/" "$TEMP_DIR"/*.py && \
cp "$TEMP_DIR"/*.py "$PY_PULUMIRPC"'
echo Done.
echo "* Done."