diff --git a/Dockerfile b/Dockerfile index 0eab25c..0a479ae 100644 --- a/Dockerfile +++ b/Dockerfile @@ -4,6 +4,7 @@ ARG GRPC_GATEWAY_VERSION=1.16.0 ARG GRPC_JAVA_VERSION=1.35.0 ARG GRPC_CSHARP_VERSION=1.35.0 ARG GRPC_VERSION=1.35.0 +ARG GRPC_WEB_VERSION=1.3.1 ARG PROTOC_GEN_GO_VERSION=1.31.0 # v1.3.2, using the version directly does not work: "tar: invalid magic" ARG PROTOC_GEN_GOGO_VERSION=b03c65ea87cdc3521ede29f62fe3ce239267c1bc @@ -49,6 +50,10 @@ RUN mkdir -p /grpc-java && \ rm -Rf /grpc-java && \ rm -Rf /grpc +ARG GRPC_WEB_VERSION +RUN curl -sSLO https://github.com/grpc/grpc-web/releases/download/${GRPC_WEB_VERSION}/protoc-gen-grpc-web-${GRPC_WEB_VERSION}-linux-x86_64 && \ + mv protoc-gen-grpc-web-${GRPC_WEB_VERSION}-linux-x86_64 /out/usr/bin/protoc-gen-grpc-web && \ + chmod +x /out/usr/bin/protoc-gen-grpc-web FROM protoc_base AS protoc_cs_builder ARG GRPC_CSHARP_VERSION diff --git a/README.md b/README.md index cb93ed7..f3f0394 100644 --- a/README.md +++ b/README.md @@ -20,13 +20,15 @@ A lightweight `protoc` Docker image, published as `jaegertracing/protobuf` to [D - https://github.com/grpc-ecosystem/grpc-gateway - https://github.com/grpc/grpc - https://github.com/grpc/grpc-java +- https://github.com/grpc/grpc-web ## Supported languages - C# - C++ - Go - Java / JavaNano (Android) -- JavaScript +- JavaScript (pure) +- TypeScript (gRPC Web) - Objective-C - PHP - Python @@ -56,6 +58,7 @@ $ docker run --rm jaegertracing/protobuf --help --php_out=OUT_DIR Generate PHP source file. --python_out=OUT_DIR Generate Python source file. --ruby_out=OUT_DIR Generate Ruby source file. + --js_out=OUT_DIR --grpc-web_out=import_style=typescript,mode=grpcweb:OUT_DIR Generate Typescript source file. ``` Example for Java: @@ -64,6 +67,11 @@ docker run --rm -u $(id -u) -v${PWD}:${PWD} -w${PWD} jaegertracing/protobuf:late --java_out=${PWD} -I/usr/include/github.com/gogo/protobuf ${PWD}/model.proto ``` +Note about Typescript: +This is currently an experimental feature. +**Do not** use `import_style=typescript` for `--js_out` ([read plugin documentation](https://github.com/grpc/grpc-web#typescript-support)) + + CLI options: - `--proto_path`: The path where protoc should search for proto files - `--java_out` : Generate Java code in the provided path