diff --git a/Makefile b/Makefile index 1db07bd13..f968c7dc3 100644 --- a/Makefile +++ b/Makefile @@ -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:: diff --git a/sdk/proto/Dockerfile b/sdk/proto/Dockerfile index 47aa50d9b..ba0f9a00a 100644 --- a/sdk/proto/Dockerfile +++ b/sdk/proto/Dockerfile @@ -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 diff --git a/sdk/proto/generate.sh b/sdk/proto/generate.sh index ad8807d0d..4e81385a5 100755 --- a/sdk/proto/generate.sh +++ b/sdk/proto/generate.sh @@ -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."