Skip to content

Commit aabc991

Browse files
Update protoc, grpc-java, and mercari-grpc-federation plugins (#1744)
1 parent 084dce5 commit aabc991

File tree

75 files changed

+695
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+695
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!Dockerfile
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# syntax=docker/dockerfile:1.12
2+
FROM --platform=$BUILDPLATFORM golang:1.24.1-bookworm AS build
3+
4+
ARG TARGETOS TARGETARCH
5+
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH
6+
7+
RUN --mount=type=cache,target=/go/pkg/mod \
8+
go install -ldflags="-s -w" -trimpath github.com/mercari/grpc-federation/cmd/[email protected] \
9+
&& mv /go/bin/${GOOS}_${GOARCH}/protoc-gen-grpc-federation /go/bin/protoc-gen-grpc-federation || true
10+
11+
FROM scratch
12+
COPY --from=build --link --chown=root:root /etc/passwd /etc/passwd
13+
COPY --from=build --link --chown=root:root /go/bin/protoc-gen-grpc-federation .
14+
ENV GOROOT /
15+
USER nobody
16+
ENTRYPOINT [ "/protoc-gen-grpc-federation" ]
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
version: v1
2+
name: buf.build/community/mercari-grpc-federation
3+
plugin_version: v1.9.7
4+
source_url: https://github.com/mercari/grpc-federation
5+
integration_guide_url: https://github.com/mercari/grpc-federation/blob/main/docs/getting_started.md
6+
description: Generates a gRPC server by writing a custom option in Protocol Buffers
7+
output_languages:
8+
- go
9+
spdx_license_id: MIT
10+
license_url: https://github.com/mercari/grpc-federation/blob/v1.9.7/LICENSE
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!Dockerfile
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# syntax=docker/dockerfile:1.12
2+
FROM debian:bookworm-20250224 AS build
3+
4+
ARG TARGETARCH
5+
6+
WORKDIR /build
7+
RUN apt-get update \
8+
&& apt-get install -y curl
9+
RUN arch=${TARGETARCH}; \
10+
if [ "${arch}" = "arm64" ]; then\
11+
arch="aarch_64"; \
12+
elif [ "${arch}" = "amd64" ]; then\
13+
arch="x86_64"; \
14+
fi; \
15+
echo "${arch}"; \
16+
curl -fsSL -o protoc-gen-grpc-java https://repo1.maven.org/maven2/io/grpc/protoc-gen-grpc-java/1.71.0/protoc-gen-grpc-java-1.71.0-linux-${arch}.exe
17+
18+
FROM gcr.io/distroless/cc-debian12:latest@sha256:b7550f0b15838de14c564337eef2b804ba593ae55d81ca855421bd52f19bb480 AS base
19+
20+
FROM scratch
21+
COPY --link --from=base / /
22+
COPY --link --from=build --chmod=0755 --chown=root:root /build/protoc-gen-grpc-java .
23+
USER nobody
24+
ENTRYPOINT [ "/protoc-gen-grpc-java" ]
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: v1
2+
name: buf.build/grpc/java
3+
plugin_version: v1.71.0
4+
source_url: https://github.com/grpc/grpc-java
5+
integration_guide_url: https://grpc.io/docs/languages/java/quickstart
6+
description: Generates Java client and server stubs for the gRPC framework.
7+
deps:
8+
- plugin: buf.build/protocolbuffers/java:v30.0
9+
output_languages:
10+
- java
11+
spdx_license_id: Apache-2.0
12+
license_url: https://github.com/grpc/grpc-java/blob/v1.71.0/LICENSE
13+
registry:
14+
maven:
15+
deps:
16+
- io.grpc:grpc-core:1.71.0
17+
- io.grpc:grpc-protobuf:1.71.0
18+
- io.grpc:grpc-stub:1.71.0
19+
# Add direct dependency on newer protobuf as gRPC is still on 3.25.5
20+
- com.google.protobuf:protobuf-java:4.30.0
21+
additional_runtimes:
22+
- name: lite
23+
deps:
24+
- io.grpc:grpc-core:1.71.0
25+
- io.grpc:grpc-protobuf-lite:1.71.0
26+
- io.grpc:grpc-stub:1.71.0
27+
# Add direct dependency on newer protobuf as gRPC is still on 3.25.5
28+
- com.google.protobuf:protobuf-javalite:4.30.0
29+
- build.buf:protobuf-javalite:4.30.0
30+
opts: [lite]
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*
2+
!BUILD
3+
!cpp.cc
4+
!Dockerfile
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
cc_binary(
2+
name = "protoc-gen-cpp",
3+
srcs = ["cpp.cc"],
4+
deps = [
5+
"//:protoc_lib",
6+
],
7+
)
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# syntax=docker/dockerfile:1.12
2+
FROM debian:bookworm-20250224 AS build
3+
4+
ARG TARGETARCH
5+
ARG BAZEL_OPTS="--host_jvm_args=-Djava.net.preferIPv4Stack=true"
6+
7+
RUN apt-get update \
8+
&& apt-get install -y curl git cmake build-essential autoconf clang libc++-dev libtool pkg-config unzip zip
9+
RUN curl -fsSL -o /usr/local/bin/bazelisk https://github.com/bazelbuild/bazelisk/releases/download/v1.25.0/bazelisk-linux-${TARGETARCH} \
10+
&& chmod +x /usr/local/bin/bazelisk \
11+
&& mkdir /build \
12+
&& chown nobody:nogroup /build \
13+
&& usermod --home /build nobody
14+
15+
USER nobody
16+
WORKDIR /build
17+
RUN curl -fsSL -o protoc.tar.gz https://github.com/protocolbuffers/protobuf/releases/download/v30.0/protobuf-30.0.tar.gz \
18+
&& tar --strip-components=1 -zxf protoc.tar.gz \
19+
&& rm protoc.tar.gz
20+
RUN bazelisk ${BAZEL_OPTS} build '//:protoc_lib'
21+
COPY --link BUILD cpp.cc plugins/
22+
RUN bazelisk ${BAZEL_OPTS} build '//plugins:protoc-gen-cpp.stripped'
23+
24+
FROM gcr.io/distroless/cc-debian12:latest@sha256:b7550f0b15838de14c564337eef2b804ba593ae55d81ca855421bd52f19bb480 AS base
25+
26+
FROM scratch
27+
COPY --from=base --link / /
28+
COPY --from=build --link --chmod=0755 /build/bazel-bin/plugins/protoc-gen-cpp .
29+
USER nobody
30+
ENTRYPOINT ["/protoc-gen-cpp"]
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: v1
2+
name: buf.build/protocolbuffers/cpp
3+
plugin_version: v30.0
4+
source_url: https://github.com/protocolbuffers/protobuf
5+
description: Base types for C++. Generates message and enum types.
6+
output_languages:
7+
- cpp
8+
spdx_license_id: BSD-3-Clause
9+
license_url: https://github.com/protocolbuffers/protobuf/blob/v30.0/LICENSE
10+
registry:
11+
cmake: {}

0 commit comments

Comments
 (0)