@@ -302,8 +302,8 @@ FROM moul/protoc-gen-gotemplate:v${PROTOC_GEN_GOTEMPLATE_VERSION} as protoc_gen_
302
302
FROM --platform=$BUILDPLATFORM alpine_host as upx
303
303
RUN mkdir -p /upx
304
304
ARG BUILDARCH BUILDOS UPX_VERSION
305
- RUN curl -sSL https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-${BUILDARCH}_${BUILDOS}.tar.xz | tar xJ --strip 1 -C /upx
306
- RUN install -D /upx/upx /usr/local/bin/upx
305
+ RUN if ! [ "${TARGETARCH}" = "arm64" ]; then curl -sSL https://github.com/upx/upx/releases/download/v${UPX_VERSION}/upx-${UPX_VERSION}-${BUILDARCH}_${BUILDOS}.tar.xz | tar xJ --strip 1 -C /upx; fi
306
+ RUN if ! [ "${TARGETARCH}" = "arm64" ]; then install -D /upx/upx /usr/local/bin/upx; fi
307
307
COPY --from=googleapis /out/ /out/
308
308
COPY --from=grpc_swift /protoc-gen-swift /out/protoc-gen-swift
309
309
COPY --from=grpc_gateway /out/ /out/
@@ -320,10 +320,15 @@ COPY --from=protoc_gen_jsonschema /out/ /out/
320
320
COPY --from=protoc_gen_lint /out/ /out/
321
321
COPY --from=protoc_gen_rust /out/ /out/
322
322
COPY --from=protoc_gen_validate /out/ /out/
323
- RUN upx --lzma $(find /out/usr/bin/ \
324
- -type f -name 'grpc_*' \
325
- -or -name 'protoc-gen-*' \
326
- )
323
+ ARG TARGETARCH
324
+ RUN <<EOF
325
+ if ! [ "${TARGETARCH}" = "arm64" ]; then
326
+ upx --lzma $(find /out/usr/bin/ -type f \
327
+ -name 'protoc-gen-*' -or \
328
+ -name 'grpc_*' \
329
+ )
330
+ fi
331
+ EOF
327
332
RUN find /out -name "*.a" -delete -or -name "*.la" -delete
328
333
329
334
@@ -334,23 +339,68 @@ COPY --from=protoc_gen_dart /out/ /
334
339
COPY --from=protoc_gen_ts /out/ /
335
340
RUN apk add --no-cache \
336
341
bash\
337
- gcompat \
338
342
grpc \
339
- libstdc++ \
340
343
protobuf \
344
+ protobuf-dev \
341
345
protobuf-c-compiler
342
- ARG TARGETARCH
343
- RUN if ! [ "${TARGETARCH}" = "arm64" ]; then apk add --no-cache grpc-java; fi
346
+ RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
347
+ RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.35-r0/glibc-2.35-r0.apk
348
+ RUN apk add glibc-2.35-r0.apk
349
+ RUN rm -f glibc-2.35-r0.apk
344
350
RUN ln -s /usr/bin/grpc_cpp_plugin /usr/bin/protoc-gen-grpc-cpp
345
351
RUN ln -s /usr/bin/grpc_csharp_plugin /usr/bin/protoc-gen-grpc-csharp
346
352
RUN ln -s /usr/bin/grpc_node_plugin /usr/bin/protoc-gen-grpc-js
347
353
RUN ln -s /usr/bin/grpc_objective_c_plugin /usr/bin/protoc-gen-grpc-objc
348
354
RUN ln -s /usr/bin/grpc_php_plugin /usr/bin/protoc-gen-grpc-php
349
355
RUN ln -s /usr/bin/grpc_python_plugin /usr/bin/protoc-gen-grpc-python
350
356
RUN ln -s /usr/bin/grpc_ruby_plugin /usr/bin/protoc-gen-grpc-ruby
357
+ RUN ln -s /usr/bin/protoc-gen-go-grpc /usr/bin/protoc-gen-grpc-go
351
358
RUN ln -s /usr/bin/protoc-gen-rust-grpc /usr/bin/protoc-gen-grpc-rust
359
+ COPY protoc-wrapper /usr/bin/protoc-wrapper
360
+ RUN mkdir -p /test
361
+ RUN protoc-wrapper \
362
+ --c_out=/test \
363
+ # --dart_out=/test \
364
+ --go_out=/test \
365
+ # --gotemplate_out=/test \
366
+ --govalidators_out=/test \
367
+ --gql_out=/test \
368
+ --grpc-cpp_out=/test \
369
+ --grpc-csharp_out=/test \
370
+ --grpc-go_out=/test \
371
+ --grpc-js_out=/test \
372
+ --grpc-objc_out=/test \
373
+ --grpc-php_out=/test \
374
+ --grpc-python_out=/test \
375
+ --grpc-ruby_out=/test \
376
+ --grpc-rust_out=/test \
377
+ --grpc-web_out=import_style=commonjs,mode=grpcwebtext:/test \
378
+ --js_out=import_style=commonjs:/test \
379
+ --jsonschema_out=/test \
380
+ --lint_out=/test \
381
+ --php_out=/test \
382
+ --python_out=/test \
383
+ --ruby_out=/test \
384
+ --rust_out=/test \
385
+ --ts_out=/test \
386
+ --validate_out=lang=go:/test \
387
+ google/protobuf/any.proto
388
+ RUN protoc-wrapper \
389
+ --gogo_out=/test \
390
+ google/protobuf/any.proto
391
+ ARG TARGETARCH
392
+ RUN if ! [ "${TARGETARCH}" = "arm64" ]; then apk add --no-cache grpc-java; fi
352
393
RUN if ! [ "${TARGETARCH}" = "arm64" ]; then ln -s /protoc-gen-swift/protoc-gen-grpc-swift /usr/bin/protoc-gen-grpc-swift; fi
353
394
RUN if ! [ "${TARGETARCH}" = "arm64" ]; then ln -s /protoc-gen-swift/protoc-gen-swift /usr/bin/protoc-gen-swift; fi
354
- COPY protoc-wrapper /usr/bin/protoc-wrapper
355
- ENV LD_LIBRARY_PATH='/usr/lib:/usr/lib64:/usr/lib/local'
395
+ RUN <<EOF
396
+ if ! [ "${TARGETARCH}" = "arm64" ]; then
397
+ protoc-wrapper \
398
+ --java_out=/test \
399
+ --grpc-java_out=/test \
400
+ --grpc-swift_out=/test \
401
+ --swift_out=/test \
402
+ google/protobuf/any.proto
403
+ fi
404
+ EOF
405
+ RUN rm -rf /test
356
406
ENTRYPOINT ["protoc-wrapper" , "-I/usr/include" ]
0 commit comments