Skip to content

Commit 94df987

Browse files
Update connectrpc/python and grpc-gateway (#2205)
1 parent b057718 commit 94df987

17 files changed

Lines changed: 883 additions & 0 deletions

File tree

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.19
2+
FROM python:3.11.14-bookworm AS build
3+
WORKDIR /app
4+
RUN python -mvenv /app
5+
RUN . ./bin/activate \
6+
&& pip install --no-cache-dir protoc-gen-connect-python==0.8.0 \
7+
&& pip uninstall --yes pip setuptools \
8+
&& rm -f bin/activate.fish bin/activate.csh bin/Activate.ps1
9+
10+
FROM gcr.io/distroless/python3-debian12:latest@sha256:2971dbfa56eb4f2e33e94709579783406c1e7165b2d92edaa5657da5e8040617 AS base
11+
12+
FROM scratch
13+
COPY --link --from=base / /
14+
COPY --link --from=build --chmod=0755 /app /app
15+
USER nobody
16+
ENTRYPOINT [ "/app/bin/protoc-gen-connect-python" ]
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: v1
2+
name: buf.build/connectrpc/python
3+
plugin_version: v0.8.0
4+
source_url: https://github.com/connectrpc/connect-python
5+
description: Generates client and server stubs for Connect Python. Compatible with the Connect RPC protocol.
6+
spdx_license_id: Apache-2.0
7+
license_url: https://github.com/connectrpc/connect-python/blob/v0.8.0/LICENSE
8+
deps:
9+
- plugin: buf.build/protocolbuffers/python:v33.3
10+
output_languages:
11+
- python
12+
registry:
13+
python:
14+
package_type: "runtime"
15+
# https://github.com/connectrpc/connect-python/blob/v0.8.0/protoc-gen-connect-python/pyproject.toml#L11
16+
requires_python: ">=3.10"
17+
deps:
18+
# https://pypi.org/project/connect-python/
19+
- "connect-python >= 0.8.0"
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
*
2+
!Dockerfile
3+
!separate_pkg_additional_imports.patch
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# syntax=docker/dockerfile:1.19
2+
FROM --platform=$BUILDPLATFORM golang:1.25.6-bookworm AS build
3+
4+
ARG TARGETOS TARGETARCH
5+
ENV CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH
6+
7+
WORKDIR /tmp
8+
RUN git clone --depth 1 --branch v2.27.5 https://github.com/grpc-ecosystem/grpc-gateway.git
9+
COPY --link separate_pkg_additional_imports.patch /tmp/separate_pkg_additional_imports.patch
10+
WORKDIR /tmp/grpc-gateway
11+
RUN git apply /tmp/separate_pkg_additional_imports.patch
12+
WORKDIR /tmp/grpc-gateway/protoc-gen-grpc-gateway
13+
RUN --mount=type=cache,target=/go/pkg/mod \
14+
go install -ldflags="-s -w" -trimpath \
15+
&& mv /go/bin/${GOOS}_${GOARCH}/protoc-gen-grpc-gateway /go/bin/protoc-gen-grpc-gateway || true
16+
17+
FROM scratch
18+
COPY --from=build --link --chown=root:root /etc/passwd /etc/passwd
19+
COPY --from=build --link --chown=root:root /go/bin/protoc-gen-grpc-gateway /
20+
USER nobody
21+
ENTRYPOINT [ "/protoc-gen-grpc-gateway" ]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: v1
2+
name: buf.build/grpc-ecosystem/gateway
3+
plugin_version: v2.27.5
4+
source_url: https://github.com/grpc-ecosystem/grpc-gateway
5+
integration_guide_url: https://github.com/grpc-ecosystem/grpc-gateway#usage
6+
description: gRPC to JSON proxy generator following the gRPC HTTP spec.
7+
output_languages:
8+
- go
9+
registry:
10+
go:
11+
min_version: "1.24"
12+
deps:
13+
- module: github.com/grpc-ecosystem/grpc-gateway/v2
14+
version: v2.27.5
15+
opts:
16+
- paths=source_relative
17+
- standalone=true
18+
- separate_package=true
19+
deps:
20+
- plugin: buf.build/protocolbuffers/go:v1.36.11
21+
- plugin: buf.build/grpc/go:v1.6.0
22+
spdx_license_id: BSD-3-Clause
23+
license_url: https://github.com/grpc-ecosystem/grpc-gateway/blob/v2.27.5/LICENSE

0 commit comments

Comments
 (0)