From e4aa721c282dac69b89960bb37adccd44bee58f4 Mon Sep 17 00:00:00 2001 From: strophy Date: Fri, 17 Mar 2023 10:40:24 +0800 Subject: [PATCH] chore: reduce docker layer count in final image --- Dockerfile | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) diff --git a/Dockerfile b/Dockerfile index 842ad7ce..cb4f0c53 100644 --- a/Dockerfile +++ b/Dockerfile @@ -415,9 +415,9 @@ COPY --from=protoc_gen_scala /out/ /out/ COPY --from=protoc_gen_validate /out/ /out/ ARG TARGETARCH RUN find /out/usr/bin/ -type f \ - -name 'protoc-gen-*' | \ - xargs -P $(nproc) -I{} \ - upx --lzma {} + -name 'protoc-gen-*' | \ + xargs -P $(nproc) -I{} \ + upx --lzma {} RUN find /out -name "*.a" -delete -or -name "*.la" -delete @@ -438,18 +438,18 @@ COPY --from=protoc_gen_ts /out/ / COPY --from=protoc_gen_dart /out/ / COPY --from=protoc_gen_dart /runtime/ / RUN python3 -m ensurepip && pip3 install --no-cache nanopb==${PROTOC_GEN_NANOPB_VERSION} -RUN ln -s /usr/bin/grpc_cpp_plugin /usr/bin/protoc-gen-grpc-cpp -RUN ln -s /usr/bin/grpc_csharp_plugin /usr/bin/protoc-gen-grpc-csharp -RUN ln -s /usr/bin/grpc_node_plugin /usr/bin/protoc-gen-grpc-js -RUN ln -s /usr/bin/grpc_objective_c_plugin /usr/bin/protoc-gen-grpc-objc -RUN ln -s /usr/bin/grpc_php_plugin /usr/bin/protoc-gen-grpc-php -RUN ln -s /usr/bin/grpc_python_plugin /usr/bin/protoc-gen-grpc-python -RUN ln -s /usr/bin/grpc_ruby_plugin /usr/bin/protoc-gen-grpc-ruby -RUN ln -s /usr/bin/protoc-gen-go-grpc /usr/bin/protoc-gen-grpc-go -RUN ln -s /usr/bin/protoc-gen-rust-grpc /usr/bin/protoc-gen-grpc-rust +RUN ln -s /usr/bin/grpc_cpp_plugin /usr/bin/protoc-gen-grpc-cpp && \ + ln -s /usr/bin/grpc_csharp_plugin /usr/bin/protoc-gen-grpc-csharp && \ + ln -s /usr/bin/grpc_node_plugin /usr/bin/protoc-gen-grpc-js && \ + ln -s /usr/bin/grpc_objective_c_plugin /usr/bin/protoc-gen-grpc-objc && \ + ln -s /usr/bin/grpc_php_plugin /usr/bin/protoc-gen-grpc-php && \ + ln -s /usr/bin/grpc_python_plugin /usr/bin/protoc-gen-grpc-python && \ + ln -s /usr/bin/grpc_ruby_plugin /usr/bin/protoc-gen-grpc-ruby && \ + ln -s /usr/bin/protoc-gen-go-grpc /usr/bin/protoc-gen-grpc-go && \ + ln -s /usr/bin/protoc-gen-rust-grpc /usr/bin/protoc-gen-grpc-rust COPY protoc-wrapper /usr/bin/protoc-wrapper -RUN mkdir -p /test -RUN protoc-wrapper \ +RUN mkdir -p /test && \ + protoc-wrapper \ --c_out=/test \ --dart_out=/test \ --go_out=/test \ @@ -484,8 +484,12 @@ RUN protoc-wrapper \ --gogo_out=/test \ google/protobuf/any.proto ARG TARGETARCH -RUN if ! [ "${TARGETARCH}" = "arm64" ]; then ln -s /protoc-gen-swift/protoc-gen-grpc-swift /usr/bin/protoc-gen-grpc-swift; fi -RUN if ! [ "${TARGETARCH}" = "arm64" ]; then ln -s /protoc-gen-swift/protoc-gen-swift /usr/bin/protoc-gen-swift; fi +RUN <