@@ -2,43 +2,72 @@ ARG ALPINE_VERSION=3.10
22ARG GO_VERSION=1.13.4
33ARG GRPC_GATEWAY_VERSION=1.12.2
44ARG GRPC_JAVA_VERSION=1.26.0
5+ ARG GRPC_CSHARP_VERSION=1.28.1
56ARG GRPC_VERSION=1.26.0
67ARG PROTOC_GEN_GO_VERSION=1.3.2
78ARG PROTOC_GEN_GOGO_VERSION=ba06b47c162d49f2af050fb4c75bcbc86a159d5c
89ARG PROTOC_GEN_LINT_VERSION=0.2.1
910ARG UPX_VERSION=3.96
1011
1112
12- FROM alpine:${ALPINE_VERSION} as protoc_builder
13- RUN apk add --no-cache build-base curl automake autoconf libtool git zlib-dev
14-
15- RUN mkdir -p /out
13+ FROM alpine:${ALPINE_VERSION} as protoc_base
14+ RUN apk add --no-cache build-base curl cmake autoconf libtool git zlib-dev linux-headers && \
15+ mkdir -p /out
1616
1717
18+ FROM protoc_base as protoc_builder
1819ARG GRPC_VERSION
19- RUN git clone --recursive --depth=1 -b v${GRPC_VERSION} https://github.com/grpc/grpc.git /grpc && \
20+ RUN apk add --no-cache automake && \
21+ git clone --recursive --depth=1 -b v${GRPC_VERSION} https://github.com/grpc/grpc.git /grpc && \
2022 ln -s /grpc/third_party/protobuf /protobuf && \
2123 cd /protobuf && \
2224 ./autogen.sh && \
2325 ./configure --prefix=/usr --enable-static=no && \
24- make && \
25- make check && \
26- make install && \
27- make install DESTDIR=/out && \
26+ make -j4 && \
27+ make -j4 check && \
28+ make -j4 install && \
29+ make -j4 install DESTDIR=/out && \
2830 cd /grpc && \
29- make install-plugins prefix=/out/usr
31+ make -j4 install-plugins prefix=/out/usr
3032
3133ARG GRPC_JAVA_VERSION
3234RUN mkdir -p /grpc-java && \
3335 curl -sSL https://api.github.com/repos/grpc/grpc-java/tarball/v${GRPC_JAVA_VERSION} | tar xz --strip 1 -C /grpc-java && \
3436 cd /grpc-java && \
3537 g++ \
3638 -I. -I/protobuf/src \
39+ -I/out/usr/include \
3740 compiler/src/java_plugin/cpp/*.cpp \
38- -L/protobuf/src/.libs \
41+ -L/out/usr/lib \
42+ -L/out/usr/lib64 \
3943 -lprotoc -lprotobuf -lpthread --std=c++0x -s \
4044 -o protoc-gen-grpc-java && \
41- install -Ds protoc-gen-grpc-java /out/usr/bin/protoc-gen-grpc-java
45+ install -Ds protoc-gen-grpc-java /out/usr/bin/protoc-gen-grpc-java && \
46+ rm -Rf /grpc-java && \
47+ rm -Rf /grpc
48+
49+
50+ FROM protoc_base AS protoc_cs_builder
51+ ARG GRPC_CSHARP_VERSION
52+ RUN git clone --recursive --depth=1 -b v${GRPC_CSHARP_VERSION} https://github.com/grpc/grpc.git /grpc && \
53+ ln -s /grpc/third_party/protobuf /protobuf && \
54+ mkdir -p /grpc/cmake/build && \
55+ cd /grpc/cmake/build && \
56+ cmake \
57+ -DCMAKE_BUILD_TYPE=Release \
58+ -DgRPC_BUILD_TESTS=OFF \
59+ -gRPC_BUILD_GRPC_CPP_PLUGIN=OFF \
60+ -gRPC_BUILD_GRPC_NODE_PLUGIN=OFF \
61+ -gRPC_BUILD_GRPC_OBJECTIVE_C_PLUGIN=OFF \
62+ -gRPC_BUILD_GRPC_PHP_PLUGIN=OFF \
63+ -gRPC_BUILD_GRPC_PYTHON_PLUGIN=OFF \
64+ -gRPC_BUILD_GRPC_RUBY_PLUGIN=OFF \
65+ -DgRPC_INSTALL=ON \
66+ -DCMAKE_INSTALL_PREFIX=/out/usr \
67+ ../.. && \
68+ make -j4 install && \
69+ rm -Rf /grpc
70+
4271
4372FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} as go_builder
4473RUN apk add --no-cache build-base curl git
@@ -84,21 +113,27 @@ RUN mkdir -p ${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway && \
84113 install -D $(find ./third_party/googleapis/google/rpc -name '*.proto' ) -t /out/usr/include/google/rpc
85114
86115
87-
88116FROM alpine:${ALPINE_VERSION} as packer
89117RUN apk add --no-cache curl
90118
91119ARG UPX_VERSION
92120RUN mkdir -p /upx && curl -sSL https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-amd64_linux.tar.xz | tar xJ --strip 1 -C /upx && \
93121 install -D /upx/upx /usr/local/bin/upx
94122
123+ # Use all output including headers and protoc from protoc_builder
95124COPY --from=protoc_builder /out/ /out/
125+ # Use protoc and plugin from protoc_cs_builder
126+ COPY --from=protoc_cs_builder /out/usr/bin/protoc-* /out/usr/bin/protoc-csharp
127+ COPY --from=protoc_cs_builder /out/usr/bin/grpc_csharp_plugin /out/usr/bin/grpc_csharp_plugin
128+ # Integrate all output from go_builder
96129COPY --from=go_builder /out/ /out/
130+
97131RUN upx --lzma \
98132 /out/usr/bin/grpc_* \
99133 /out/usr/bin/protoc-gen-*
100134RUN find /out -name "*.a" -delete -or -name "*.la" -delete
101135
136+
102137FROM alpine:${ALPINE_VERSION}
103138LABEL maintainer="The Jaeger Authors"
104139COPY --from=packer /out/ /
0 commit comments