diff --git a/tools/dockerfile/grpc_node/Dockerfile b/tools/dockerfile/grpc_node/Dockerfile new file mode 100644 index 00000000000..baec0e21d84 --- /dev/null +++ b/tools/dockerfile/grpc_node/Dockerfile @@ -0,0 +1,14 @@ +# Dockerfile for gRPC Node +FROM grpc/node_base + +# Update the C libary +RUN cd /var/local/git/grpc \ + && git pull --recurse-submodules \ + && git submodule update --init --recursive + +# Install the C core. +RUN make install_c -C /var/local/git/grpc + +RUN cd /var/local/git/grpc/src/node && npm install && node-gyp rebuild + +CMD ["/usr/bin/nodejs", "/var/local/git/grpc/src/node/interop/interop_server.js", "--use_tls=true", "--port 8040"] \ No newline at end of file diff --git a/tools/dockerfile/grpc_node_base/Dockerfile b/tools/dockerfile/grpc_node_base/Dockerfile new file mode 100644 index 00000000000..28bd7b2556f --- /dev/null +++ b/tools/dockerfile/grpc_node_base/Dockerfile @@ -0,0 +1,22 @@ +# Base Dockerfile for gRPC Node. +# +# Includes Node installation dependencies +FROM grpc/base + +RUN curl -sL https://deb.nodesource.com/setup | bash - + +RUN apt-get update && apt-get install -y nodejs + +RUN npm install -g node-gyp + +# Get the source from GitHub, this gets the protobuf library as well +RUN git clone git@github.com:google/grpc.git /var/local/git/grpc +RUN cd /var/local/git/grpc && \ + git pull --recurse-submodules && \ + git submodule update --init --recursive + +# Build the C core +RUN make static_c shared_c -j12 -C /var/local/git/grpc + +# Define the default command. +CMD ["bash"] \ No newline at end of file diff --git a/tools/gce_setup/grpc_docker.sh b/tools/gce_setup/grpc_docker.sh index 16d6ef40e31..602d04b2a6a 100755 --- a/tools/gce_setup/grpc_docker.sh +++ b/tools/gce_setup/grpc_docker.sh @@ -350,7 +350,7 @@ grpc_interop_test_args() { [[ -n $1 ]] && { # client_type case $1 in - cxx|go|java|nodejs|php|python|ruby) + cxx|go|java|node|php|python|ruby) grpc_gen_test_cmd="grpc_interop_gen_$1_cmd" declare -F $grpc_gen_test_cmd >> /dev/null || { echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 @@ -381,7 +381,7 @@ grpc_interop_test_args() { cxx) grpc_port=8010 ;; go) grpc_port=8020 ;; java) grpc_port=8030 ;; - nodejs) grpc_port=8040 ;; + node) grpc_port=8040 ;; python) grpc_port=8050 ;; ruby) grpc_port=8060 ;; *) echo "bad server_type: $1" 1>&2; return 1 ;; @@ -421,7 +421,7 @@ grpc_cloud_prod_test_args() { [[ -n $1 ]] && { # client_type case $1 in - cxx|go|java|nodejs|php|python|ruby) + cxx|go|java|node|php|python|ruby) grpc_gen_test_cmd="grpc_cloud_prod_gen_$1_cmd" declare -F $grpc_gen_test_cmd >> /dev/null || { echo "-f: test_func for $1 => $grpc_gen_test_cmd is not defined" 1>&2 @@ -555,7 +555,7 @@ grpc_launch_server_args() { cxx) grpc_port=8010 ;; go) grpc_port=8020 ;; java) grpc_port=8030 ;; - nodejs) grpc_port=8040 ;; + node) grpc_port=8040 ;; python) grpc_port=8050 ;; ruby) grpc_port=8060 ;; *) echo "bad server_type: $1" 1>&2; return 1 ;; @@ -627,7 +627,7 @@ grpc_launch_server() { # cxx: 8010 # go: 8020 # java: 8030 -# nodejs: 8040 +# node: 8040 # python: 8050 # ruby: 8060 # @@ -813,6 +813,13 @@ grpc_interop_gen_cxx_cmd() { echo $the_cmd } +grpc_interop_gen_node_cmd() { + local cmd_prefix="sudo docker run grpc/node"; + local test_script="/usr/bin/nodejs /var/local/git/grpc/src/node/interop/interop_client.js --use_tls=true"; + local the_cmd="$cmd_prefix $test_script $@"; + echo $the_cmd +} + # constructs the full dockerized cpp interop test cmd. # # @@ -827,4 +834,4 @@ grpc_cloud_prod_gen_cxx_cmd() { echo $the_cmd } -# TODO(grpc-team): add grpc_interop_gen_xxx_cmd for python|cxx|nodejs +# TODO(grpc-team): add grpc_interop_gen_python_cmd diff --git a/tools/gce_setup/shared_startup_funcs.sh b/tools/gce_setup/shared_startup_funcs.sh index 69f6ba8cc00..438c20a3d6d 100755 --- a/tools/gce_setup/shared_startup_funcs.sh +++ b/tools/gce_setup/shared_startup_funcs.sh @@ -367,7 +367,7 @@ grpc_docker_launch_registry() { grpc_docker_pull_known() { local addr=$1 [[ -n $addr ]] || addr="0.0.0.0:5000" - local known="base cxx php_base php ruby_base ruby java_base java go" + local known="base cxx php_base php ruby_base ruby java_base java go node_base node" echo "... pulling docker images for '$known'" for i in $known do