Skip to content

bdlm/docker-protoc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

docker-protoc

Mature This project adheres to Semantic Versioning. This package is considered mature, you should expect package stability in Minor and Patch version releases.

  • Major: backwards incompatible package updates
  • Minor: feature additions, removal of deprecated features
  • Patch: bug fixes, backward compatible model and function changes, etc.

CHANGELOG

Release DockerHub image pulls Github issues Github pull requests MIT

This image is used to compile protobuf API definitions into Golang gRPC and REST services using the grpc-gateway package.

Available Packages

  • github.com/envoyproxy/protoc-gen-validate
  • github.com/golang/mock
  • github.com/golang/protobuf
  • github.com/golang/protobuf/protoc-gen-go
  • github.com/grpc-ecosystem/grpc-gateway
  • github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
  • github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
  • github.com/kisielk/errcheck
  • github.com/shurcooL/vfsgen
  • google.golang.org/grpc

Examples

Examples of compiling the service orchestration healthchecks.

Generate gRPC-Gateway packages with swagger docs

protoc \
	-I=${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway/third_party/googleapis \
	-I=${GOPATH}/src/github.com/envoyproxy \
	-I=${GOPATH}/src/github.com/grpc-ecosystem/grpc-gateway \
	-I=${GOPATH}/src/github.com/bdlm/api/proto/v1/orchestration \
	-I=/usr/local/include \
	--go_opt=paths=source_relative \
	--go_out=plugins=grpc:${GOPATH}/src/github.com/bdlm/api/proto/v1/orchestration \
	--grpc-gateway_out=logtostderr=true:${GOPATH}/src/github.com/bdlm/api/proto/v1/orchestration \
	--validate_out=lang=go:${GOPATH}/src/github.com/bdlm/api/proto/v1/orchestration \
	--swagger_out=logtostderr=true,allow_merge=true,merge_file_name=external.swagger:${GOPATH}/src/github.com/bdlm/api/ \
	proto/v1/orchestration/swagger \
	${GOPATH}/src/github.com/bdlm/api/proto/v1/orchestration/response.proto

Generate embedded docs with vfsgen

go run -mod=vendor \
	${GOPATH}/src/github.com/bdlm/docker-protoc/vfsgen.go \
	--dir=./orchestration/swagger/ \
	--outfile=./orchestration/docs/docs.go \
	--pkg=docs \
	--variable=Docs

Generate service mocks

mockgen \
	--destination=./orchestration/mock/mock.go \
	github.com/bdlm/api/proto/v1/orchestration \
	OrchestrationClient,OrchestrationServer