feat(tonic-web): implement grpc <-> grpc-web protocol translation (#455)
tonic-web enables tonic servers to handle requests from grpc-web clients directly, without the need of an external proxy. Co-authored-by: John Hernandez <[email protected]> Co-authored-by: zancas <[email protected]>
This commit is contained in:
co-authored by
John Hernandez
zancas
parent
352b0f584b
commit
c309063254
@@ -0,0 +1,28 @@
|
||||
FROM node:12-stretch
|
||||
|
||||
RUN apt-get install -y unzip
|
||||
|
||||
WORKDIR /tmp
|
||||
|
||||
RUN curl -sSL https://github.com/protocolbuffers/protobuf/releases/download/v3.14.0/\
|
||||
protoc-3.14.0-linux-x86_64.zip -o protoc.zip && \
|
||||
unzip -qq protoc.zip && \
|
||||
cp ./bin/protoc /usr/local/bin/protoc
|
||||
|
||||
RUN curl -sSL https://github.com/grpc/grpc-web/releases/download/1.2.1/\
|
||||
protoc-gen-grpc-web-1.2.1-linux-x86_64 -o /usr/local/bin/protoc-gen-grpc-web && \
|
||||
chmod +x /usr/local/bin/protoc-gen-grpc-web
|
||||
|
||||
WORKDIR /
|
||||
|
||||
COPY ./client ./
|
||||
|
||||
RUN echo "\nloglevel=error\n" >> $HOME/.npmrc && npm install && mkdir -p binary text
|
||||
|
||||
RUN protoc -I=. ./test.proto\
|
||||
--js_out=import_style=commonjs:./text\
|
||||
--grpc-web_out=import_style=commonjs,mode=grpcwebtext:./text
|
||||
|
||||
RUN protoc -I=. ./test.proto\
|
||||
--js_out=import_style=commonjs:./binary\
|
||||
--grpc-web_out=import_style=commonjs,mode=grpcweb:./binary
|
||||
Reference in New Issue
Block a user