Skip to content

Instantly share code, notes, and snippets.

@pablodz
Last active July 11, 2023 23:10
Show Gist options
  • Save pablodz/d057796da52a9cbf9d8350c4027739e6 to your computer and use it in GitHub Desktop.
Save pablodz/d057796da52a9cbf9d8350c4027739e6 to your computer and use it in GitHub Desktop.
Easy way to compile grpc, grpc_plugins and protoc to compile all .proto files to any language
FROM ubuntu:latest
WORKDIR /app
RUN apt-get update && \
apt-get install -y \
build-essential \
autoconf \
libtool \
pkg-config \
git \
cmake
RUN git clone --recurse-submodules -b v1.54.2 https://github.com/grpc/grpc && \
cd grpc && \
mkdir -p cmake/build && \
cd cmake/build && \
cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local ../.. && \
make -j$(nproc) && \
make plugins -j$(nproc) && \
make install && \
cd ../../.. && \
rm -rf grpc
# Do not remove this line
# Here is stored the grpc_plugins
RUN ls -lah /usr/local/bin/
# Run protoc to check version installed by grpc
RUN protoc --version
@pablodz
Copy link
Author

pablodz commented Jul 11, 2023

Step 5/7 : RUN ls -lah /usr/local/bin/
 ---> Running in da9118c91e2e
total 44M
drwxr-xr-x 1 root root 4.0K Jul 11 23:07 .
drwxr-xr-x 1 root root 4.0K Jun 24 02:02 ..
-rwxr-xr-x 1 root root 142K Jul 11 23:06 acountry
-rwxr-xr-x 1 root root 111K Jul 11 23:06 adig
-rwxr-xr-x 1 root root 129K Jul 11 23:06 ahost
-rwxr-xr-x 1 root root 5.0M Jul 11 23:06 grpc_cpp_plugin
-rwxr-xr-x 1 root root 5.0M Jul 11 23:06 grpc_csharp_plugin
-rwxr-xr-x 1 root root 4.8M Jul 11 23:06 grpc_node_plugin
-rwxr-xr-x 1 root root 5.0M Jul 11 23:06 grpc_objective_c_plugin
-rwxr-xr-x 1 root root 5.0M Jul 11 23:06 grpc_php_plugin
-rwxr-xr-x 1 root root 5.0M Jul 11 23:06 grpc_python_plugin
-rwxr-xr-x 1 root root 4.8M Jul 11 23:06 grpc_ruby_plugin
lrwxrwxrwx 1 root root   16 Jul 11 23:07 protoc -> protoc-3.21.12.0
-rwxr-xr-x 1 root root 9.3M Jul 11 23:06 protoc-3.21.12.0
Step 6/7 : RUN protoc --version
 ---> Running in c33fefa5eba5
libprotoc 3.21.12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment