Merge pull request #1703 from pulumi/joeduffy/protobufc_dockerfile
Make Protobuf/gRPC compilation repeatable
This commit is contained in:
commit
8dca3f7b48
1
Makefile
1
Makefile
|
@ -20,7 +20,6 @@ TEST_FAST_TIMEOUT := 2m
|
||||||
endif
|
endif
|
||||||
|
|
||||||
build-proto::
|
build-proto::
|
||||||
docker build -t pulumi/protobuf-builder sdk/proto
|
|
||||||
cd sdk/proto && ./generate.sh
|
cd sdk/proto && ./generate.sh
|
||||||
|
|
||||||
build::
|
build::
|
||||||
|
|
|
@ -12,10 +12,11 @@
|
||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
FROM ubuntu
|
FROM node:8
|
||||||
|
|
||||||
RUN apt-get update
|
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.
|
# 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
|
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
|
RUN go install ./protoc-gen-go
|
||||||
|
|
||||||
# Install node gRPC tools.
|
# Install node gRPC tools.
|
||||||
RUN npm install -g grpc
|
RUN ln -s /usr/bin/nodejs /usr/bin/node
|
||||||
RUN npm install -g grpc-tools
|
RUN npm install -g grpc --unsafe-perm
|
||||||
|
RUN npm install -g grpc-tools --unsafe-perm
|
||||||
|
|
||||||
# Install Python gRPC tools.
|
# Install Python gRPC tools.
|
||||||
RUN python -m pip install grpcio grpcio-tools
|
RUN python -m pip install grpcio grpcio-tools
|
||||||
|
|
|
@ -10,6 +10,10 @@
|
||||||
# different langauges, so nothing is else required to be installed on your machine.
|
# different langauges, so nothing is else required to be installed on your machine.
|
||||||
set -e
|
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"
|
DOCKER_RUN="docker run -it --rm -v $(pwd)/../python:/python -v $(pwd)/../nodejs:/nodejs -v $(pwd):/local pulumi/protobuf-builder"
|
||||||
PROTOC="$DOCKER_RUN protoc"
|
PROTOC="$DOCKER_RUN protoc"
|
||||||
|
|
||||||
|
@ -20,7 +24,7 @@ PROTOC="$DOCKER_RUN protoc"
|
||||||
PROTO_FILES=$(find . -name "*.proto" -not -name "status.proto")
|
PROTO_FILES=$(find . -name "*.proto" -not -name "status.proto")
|
||||||
JS_PROTO_FILES=$(find . -name "*.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 "\tVERSION: $($PROTOC --version)"
|
||||||
echo -e "Generated by version $($PROTOC --version) of protoc" > ./grpc_version.txt
|
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 && \
|
sed -i "s/^import \([^ ]*\)_pb2 as \([^ ]*\)$/from . import \1_pb2 as \2/" "$TEMP_DIR"/*.py && \
|
||||||
cp "$TEMP_DIR"/*.py "$PY_PULUMIRPC"'
|
cp "$TEMP_DIR"/*.py "$PY_PULUMIRPC"'
|
||||||
|
|
||||||
echo Done.
|
echo "* Done."
|
||||||
|
|
Loading…
Reference in a new issue