https://github.com/haunt98/docker-protoc
Run protoc with docker
https://github.com/haunt98/docker-protoc
Last synced: 6 months ago
JSON representation
Run protoc with docker
- Host: GitHub
- URL: https://github.com/haunt98/docker-protoc
- Owner: haunt98
- License: mit
- Created: 2020-09-17T16:50:04.000Z (about 5 years ago)
- Default Branch: main
- Last Pushed: 2021-06-24T16:43:14.000Z (over 4 years ago)
- Last Synced: 2024-04-17T18:06:11.890Z (over 1 year ago)
- Language: Dockerfile
- Homepage:
- Size: 24.4 KB
- Stars: 9
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# docker-protoc
Run `protoc` with `docker`.
## Include
- [protobuf](https://github.com/protocolbuffers/protobuf)
- [protoc-gen-go](https://github.com/protocolbuffers/protobuf-go)
- [protoc-gen-go-grpc](https://github.com/grpc/grpc-go)
- [buf](https://github.com/bufbuild/buf)## Install
```sh
IMAGE=image TAG=tag make build
```## Use
`/home/docker/app` is mount point in docker container, because user is `docker` not `root`.
Need to replace `/path/to/output`, `/path/to/proto` with your real path.
Need to replace `image`, `tag` with your custom.
### Build
```sh
docker run --rm --volume $(pwd):/home/docker/app --workdir /home/docker/app image:tag \
protoc \
-I . \
--go_out /path/to/output \
--go-grpc_out /path/to/output \
/path/to/proto
```### Lint
With `buf`:
Should include [buf.yaml](https://docs.buf.build/configuration/) file.
```sh
docker run --rm --volume $(pwd):/home/docker/app --workdir /home/docker/app image:tag \
protoc \
-I . \
--buf-check-lint_out . \
/path/to/proto
```### Format
Should include [.clang-format](https://clang.llvm.org/docs/ClangFormatStyleOptions.html) file.
```sh
docker run --rm --volume $(pwd):/home/docker/app --workdir /home/docker/app image:tag \
clang-format -i \
/path/to/proto
```