Handy Docker image for creating gRPC stub codes with bufbuild
Hi, everyone. Today I’m thinking of talking to you guys about the new handly docker image that creates gRPC stub codes with bufbuild. This post could be continued from the following post.
Handy Docker image for creating gRPC stub codes
Hi everyone. Today’s story is to create gRPC stub codes when you need them in developing PC applications with golang.
First of all, Bufbuild is a new way of working with Protocol Buffers as they said. Basically the
buf CLI is a replacement tool with
protoc. and furthermore
bufhas those features such as a linter that enforces good API design choices and structure and a breaking change detector that enforces compatibility at the source code or wire level.
But now we are a beginner of `buf` so let me see how the
bufgenerates gRPC codes from ProtocolBuffers IDL.
bufrequires three yaml files
buf.gen.yamlshould be placed in the root directory and tells the compiler to use plugins that handle for go, python and typescript etc…
buf.work.yaml should be placed in the root as same as
buf.gen.yaml and tells directories contained proto files.
buf.yaml should be placed in the directory containing the proto files and has the configure about linter or breaking change detector.
Anyway, won’t you rushly to use it? Okay. Let’s pull the docker image of buf and
Wait! Before using the docker image, I have to tell you a bad news.
Buf’s image does not contain protoc, and this is on purpose — specific generation plugins you need (including protoc, which contains the plugins for java, cpp, etc) need to be handled by you. We’ll be dealing with this ourselves in the future Buf Schema Registry, but for local generation, you are responsible for your own plugin versioning and installation. I’d recommend creating your own Docker image for this.
Compiling to Java using the provided docker image · Issue #184 · bufbuild/buf
Hi, thanks for Buf, it's really awesome! When trying to compile proto files to Java using Buf's docker image, I get the…
OMG. The buf image doesn’t contain `protoc` so you can’t generate stub codes derived from protoc. As following that proposal, we have to create a new `buf` docker image with protoc.
… No way. So I did it and made it public ;)
GitHub - tk42/bufbuild: bufbuild docker image with protoc
bufbuild docker image with protoc Buf's image does not contain protoc, and this is on purpose - specific generation…
As you can see from the repository, you should specify docker image
ghcr.io/tk42/bufbuild with following parameters.
petapis is a directory name contained the sample ProtocolBuffers files.
command: ["generate", "petapis"]
This image supports plugins for golang, python and typescript that I like. Someday I might support more languages but can’t tell you when.
See you next time!