Skip to content

Commit 1a57d2b

Browse files
Merge pull request #218 from stanley-cheung/refactor-and-cleanup
Refactor and cleanup
2 parents dc5a293 + 576e1a7 commit 1a57d2b

File tree

7 files changed

+23
-30
lines changed

7 files changed

+23
-30
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ Try gRPC-Web and run a quick Echo example from the browser!
2828
From the repo root directory:
2929

3030
```sh
31-
$ docker-compose up echo-server envoy commonjs-client-example
31+
$ docker-compose up echo-server envoy commonjs-client
3232
```
3333

3434
Open a browser tab, and inspect
@@ -106,19 +106,19 @@ Multiple proxies supports the gRPC-Web protocol. Currently, the default proxy
106106
is [Envoy](https://www.envoyproxy.io), which supports gRPC-Web out of the box.
107107

108108
```
109-
$ docker-compose up echo-server envoy commonjs-client-example
109+
$ docker-compose up echo-server envoy commonjs-client
110110
```
111111

112112
An alternative is to build Nginx that comes with this repository.
113113

114114
```
115-
$ docker-compose up echo-server nginx commonjs-client-example
115+
$ docker-compose up echo-server nginx commonjs-client
116116
```
117117

118118
Finally, you can also try this [gRPC-Web Go Proxy](https://github.com/improbable-eng/grpc-web/tree/master/go/grpcwebproxy).
119119

120120
```
121-
$ docker-compose up echo-server grpcwebproxy binary-client-example
121+
$ docker-compose up echo-server grpcwebproxy binary-client
122122
```
123123

124124

docker-compose.yml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,30 +41,30 @@ services:
4141
- "8080:8080"
4242
links:
4343
- echo-server
44-
static-assets:
44+
closure-client:
4545
build:
4646
context: ./
47-
dockerfile: ./net/grpc/gateway/docker/static_assets/Dockerfile
47+
dockerfile: ./net/grpc/gateway/docker/closure_client/Dockerfile
4848
depends_on:
4949
- prereqs
50-
image: grpc-web:static-assets
50+
image: grpc-web:closure-client
5151
ports:
5252
- "80:80"
53-
commonjs-client-example:
53+
commonjs-client:
5454
build:
5555
context: ./
56-
dockerfile: ./net/grpc/gateway/docker/commonjs_client_example/Dockerfile
56+
dockerfile: ./net/grpc/gateway/docker/commonjs_client/Dockerfile
5757
depends_on:
5858
- prereqs
59-
image: grpc-web:commonjs-client-example
59+
image: grpc-web:commonjs-client
6060
ports:
6161
- "8081:8081"
62-
binary-client-example:
62+
binary-client:
6363
build:
6464
context: ./
65-
dockerfile: ./net/grpc/gateway/docker/binary_client_example/Dockerfile
65+
dockerfile: ./net/grpc/gateway/docker/binary_client/Dockerfile
6666
depends_on:
6767
- prereqs
68-
image: grpc-web:binary-client-example
68+
image: grpc-web:binary-client
6969
ports:
7070
- "8081:8081"

net/grpc/gateway/docker/binary_client_example/Dockerfile renamed to net/grpc/gateway/docker/binary_client/Dockerfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ FROM grpc-web:prereqs
1616

1717
ARG EXAMPLE_DIR=/github/grpc-web/net/grpc/gateway/examples/echo
1818

19-
RUN cd /github/grpc-web/packages/grpc-web && \
20-
rm -rf node_modules && \
21-
npm install && \
22-
npm run build && \
23-
npm link
24-
2519
RUN protoc -I=$EXAMPLE_DIR echo.proto \
2620
--plugin=protoc-gen-grpc-web=\
2721
/github/grpc-web/javascript/net/grpc/web/protoc-gen-grpc-web \
@@ -31,7 +25,6 @@ $EXAMPLE_DIR/commonjs-example \
3125
$EXAMPLE_DIR/commonjs-example
3226

3327
RUN cd $EXAMPLE_DIR/commonjs-example && \
34-
rm -rf node_modules && \
3528
npm install && \
3629
npm link grpc-web && \
3730
./node_modules/.bin/browserify client.js > out.js

net/grpc/gateway/docker/commonjs_client_example/Dockerfile renamed to net/grpc/gateway/docker/commonjs_client/Dockerfile

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,6 @@ FROM grpc-web:prereqs
1616

1717
ARG EXAMPLE_DIR=/github/grpc-web/net/grpc/gateway/examples/echo
1818

19-
RUN cd /github/grpc-web/packages/grpc-web && \
20-
rm -rf node_modules && \
21-
npm install && \
22-
npm run build && \
23-
npm link
24-
2519
RUN protoc -I=$EXAMPLE_DIR echo.proto \
2620
--plugin=protoc-gen-grpc-web=\
2721
/github/grpc-web/javascript/net/grpc/web/protoc-gen-grpc-web \
@@ -31,7 +25,6 @@ $EXAMPLE_DIR/commonjs-example \
3125
$EXAMPLE_DIR/commonjs-example
3226

3327
RUN cd $EXAMPLE_DIR/commonjs-example && \
34-
rm -rf node_modules && \
3528
npm install && \
3629
npm link grpc-web && \
3730
./node_modules/.bin/browserify client.js > out.js

net/grpc/gateway/docker/prereqs/Dockerfile

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,10 @@ RUN curl -sL https://deb.nodesource.com/setup_8.x | bash - && \
3737
COPY . /github/grpc-web
3838

3939
RUN cd /github/grpc-web && \
40+
git checkout . && \
4041
rm -rf third_party && \
4142
git checkout third_party && \
43+
git clean -f -d -x && \
4244
./scripts/init_submodules.sh
4345

4446
RUN cd /github/grpc-web/third_party/grpc && \
@@ -50,5 +52,10 @@ RUN cd /github/grpc-web/third_party/grpc/third_party/protobuf && \
5052
RUN cd /github/grpc-web/javascript/net/grpc/web && \
5153
make
5254

55+
RUN cd /github/grpc-web/packages/grpc-web && \
56+
npm install && \
57+
npm run build && \
58+
npm link
59+
5360
RUN cp /github/grpc-web/net/grpc/gateway/examples/echo/nginx_simple.conf \
5461
/etc/nginx/nginx.conf

net/grpc/gateway/examples/echo/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@ This steps compiles the front-end gRPC-Web client into a static .JS file, and
5858
we use a simple server to serve up the JS/HTML static contents.
5959

6060
```sh
61-
$ docker build -t grpc-web:static-assets \
62-
-f net/grpc/gateway/docker/static_assets/Dockerfile .
63-
$ docker run -d -p 80:80 grpc-web:static-assets
61+
$ docker build -t grpc-web:closure-client \
62+
-f net/grpc/gateway/docker/closure-client/Dockerfile .
63+
$ docker run -d -p 80:80 grpc-web:closure-client
6464
```
6565

6666
## Run the example from your browser

0 commit comments

Comments
 (0)