Skip to content

Commit f29bd90

Browse files
authored
upgrade (#25)
Signed-off-by: Joe Elliott <number101010@gmail.com>
1 parent b1706ae commit f29bd90

File tree

1 file changed

+31
-23
lines changed

1 file changed

+31
-23
lines changed

Dockerfile

Lines changed: 31 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,37 @@
1-
ARG ALPINE_VERSION=3.10
2-
ARG GO_VERSION=1.13.4
3-
ARG GRPC_GATEWAY_VERSION=1.12.2
4-
ARG GRPC_JAVA_VERSION=1.26.0
5-
ARG GRPC_CSHARP_VERSION=1.28.1
6-
ARG GRPC_VERSION=1.26.0
7-
ARG PROTOC_GEN_GO_VERSION=1.3.2
8-
ARG PROTOC_GEN_GOGO_VERSION=ba06b47c162d49f2af050fb4c75bcbc86a159d5c
1+
ARG ALPINE_VERSION=3.13
2+
ARG GO_VERSION=1.14.15
3+
ARG GRPC_GATEWAY_VERSION=1.16.0
4+
ARG GRPC_JAVA_VERSION=1.35.0
5+
ARG GRPC_CSHARP_VERSION=1.35.0
6+
ARG GRPC_VERSION=1.35.0
7+
ARG PROTOC_GEN_GO_VERSION=1.4.3
8+
# v1.3.2, using the version directly does not work: "tar: invalid magic"
9+
ARG PROTOC_GEN_GOGO_VERSION=b03c65ea87cdc3521ede29f62fe3ce239267c1bc
910
ARG PROTOC_GEN_LINT_VERSION=0.2.1
1011
ARG UPX_VERSION=3.96
1112

12-
1313
FROM alpine:${ALPINE_VERSION} as protoc_base
1414
RUN apk add --no-cache build-base curl cmake autoconf libtool git zlib-dev linux-headers && \
1515
mkdir -p /out
1616

17-
1817
FROM protoc_base as protoc_builder
1918
ARG GRPC_VERSION
20-
RUN apk add --no-cache automake && \
19+
RUN apk add --no-cache automake ninja && \
2120
git clone --recursive --depth=1 -b v${GRPC_VERSION} https://github.com/grpc/grpc.git /grpc && \
2221
ln -s /grpc/third_party/protobuf /protobuf && \
23-
cd /protobuf && \
24-
./autogen.sh && \
25-
./configure --prefix=/usr --enable-static=no && \
26-
make -j4 && \
27-
make -j4 check && \
28-
make -j4 install && \
29-
make -j4 install DESTDIR=/out && \
30-
cd /grpc && \
31-
make -j4 install-plugins prefix=/out/usr
22+
mkdir -p /grpc/cmake/build && \
23+
cd /grpc/cmake/build && \
24+
cmake \
25+
-GNinja \
26+
-DBUILD_SHARED_LIBS=ON \
27+
-DCMAKE_INSTALL_PREFIX=/usr \
28+
-DCMAKE_BUILD_TYPE=Release \
29+
-DgRPC_INSTALL=ON \
30+
-DgRPC_BUILD_TESTS=OFF \
31+
../.. && \
32+
cmake --build . --target plugins && \
33+
cmake --build . --target install && \
34+
DESTDIR=/out cmake --build . --target install
3235

3336
ARG GRPC_JAVA_VERSION
3437
RUN mkdir -p /grpc-java && \
@@ -128,9 +131,14 @@ COPY --from=protoc_cs_builder /out/usr/bin/grpc_csharp_plugin /out/usr/bin/grpc_
128131
# Integrate all output from go_builder
129132
COPY --from=go_builder /out/ /out/
130133

131-
RUN upx --lzma \
132-
/out/usr/bin/grpc_* \
133-
/out/usr/bin/protoc-gen-*
134+
RUN upx --lzma $(find /out/usr/bin/ \
135+
-type f -name 'grpc_*' \
136+
-not -name 'grpc_node_plugin' \
137+
-not -name 'grpc_php_plugin' \
138+
-not -name 'grpc_ruby_plugin' \
139+
-not -name 'grpc_python_plugin' \
140+
-or -name 'protoc-gen-*' \
141+
)
134142
RUN find /out -name "*.a" -delete -or -name "*.la" -delete
135143

136144

0 commit comments

Comments
 (0)