Skip to content

Latest commit

 

History

History
61 lines (44 loc) · 2.31 KB

README.md

File metadata and controls

61 lines (44 loc) · 2.31 KB

Protoc container image with GRPC plugins for Go and Python

This repo contains a Dockerfile for building a container image suitable for the effortless generation of language bindings from .proto files.

The container image contains the following software components:

Versioning

This repo and the container image are tagged with the following versioning scheme:

# e.g. 21.12__1.28.1
<protoc version>__<protoc-gen-go version>

With both protoc and protoc-gen-go versions clearly stated, it is easy to determine which version of the container image contains which major software components versions used in the generation process.

A version of the gRPC plugins for Go and Python are not included in the tag, and they are provided in the Dockerfile as build arguments. For convenience, they are additionally listed in the table below.

Repo tag protoc-gen-go-grpc grpcio-tools
21.12__1.28.1 1.2.0 1.51.1
22.1__1.28.1 1.2.0 1.51.1
23.3__1.31.0 1.3.0 1.56.0
24.4__1.31.0 1.3.0 1.59.2

Build

./run.sh build
# push images
./run.sh push

Usage

Go

docker run -v $(pwd):/in \
  -v $(pwd)/proto:/in/github.com/openconfig/gnmi/proto \
  ghcr.io/srl-labs/protoc:${IMAGE_TAG} ash -c "protoc -I .:/protobuf/include --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative,require_unimplemented_servers=false proto/gnmi/gnmi.proto"

Python

docker run -v $(pwd):/in \
  -v $(pwd)/proto:/in/github.com/openconfig/gnmi/proto \
  ghcr.io/srl-labs/protoc:${IMAGE_TAG} ash -c "python3 -m grpc_tools.protoc -I ".:/protobuf/include" --python_out=. --grpc_python_out=. proto/gnmi/gnmi.proto"