Skip to content

Commit 622bf3e

Browse files
authored
Update README with language specific code generation examples … (#4)
* Update README with language specific code generation examples Signed-off-by: Annanay <annanayagarwal@gmail.com> * Add cli options list Signed-off-by: Annanay <annanayagarwal@gmail.com> * Update README, remove go file Signed-off-by: Annanay <annanayagarwal@gmail.com> * Explain CLI flags Signed-off-by: Annanay <annanayagarwal@gmail.com>
1 parent 8f39559 commit 622bf3e

File tree

4 files changed

+38
-155
lines changed

4 files changed

+38
-155
lines changed

README.md

Lines changed: 38 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,24 @@
1-
![](https://github.com/TheThingsIndustries/docker-protobuf/workflows/Docker%20Image/badge.svg)
2-
31
# Protocol Buffers + Docker
4-
A lightweight `protoc` Docker image.
5-
It started out as https://github.com/znly/docker-protobuf fork, but grew into a stand-alone project.
2+
A lightweight `protoc` Docker image, with all dependencies built-in, to generate code in multiple languages.
3+
4+
## Purpose
5+
6+
`gogoproto` annotations in proto files help make internal domain model types more efficient in golang, but using these proto files to generate code in other languages requires to include these dependencies anyway. The `Dockerfile` in this repo compiles all dependencies into the image, for easy code generation in multiple languages.
7+
8+
## Contents
69

7-
## What's included:
10+
`Dockerfile` configured with dependencies specific to the [Jaeger](github.com/jaegertracing/jaeger) project.
11+
12+
## What's included in the image
813
- https://github.com/ckaznocha/protoc-gen-lint
9-
- https://github.com/danielvladco/go-proto-gql
10-
- https://github.com/envoyproxy/protoc-gen-validate
1114
- https://github.com/gogo/protobuf
1215
- https://github.com/golang/protobuf
1316
- https://github.com/google/protobuf
1417
- https://github.com/grpc-ecosystem/grpc-gateway
1518
- https://github.com/grpc/grpc
1619
- https://github.com/grpc/grpc-java
17-
- https://github.com/grpc/grpc-swift
18-
- https://github.com/grpc/grpc-web
19-
- https://github.com/protobuf-c/protobuf-c
20-
- https://github.com/pseudomuto/protoc-gen-doc
21-
- https://github.com/stepancheg/grpc-rust
22-
- https://github.com/stepancheg/rust-protobuf
23-
- https://github.com/TheThingsIndustries/protoc-gen-fieldmask
24-
- https://github.com/TheThingsIndustries/protoc-gen-gogottn
2520

2621
## Supported languages
27-
- C
2822
- C#
2923
- C++
3024
- Go
@@ -34,15 +28,39 @@ It started out as https://github.com/znly/docker-protobuf fork, but grew into a
3428
- PHP
3529
- Python
3630
- Ruby
37-
- Rust
38-
- Swift
3931

4032
## Usage
4133
```
42-
$ docker run --rm -v<some-path>:<some-path> -w<some-path> thethingsindustries/protoc [OPTION] PROTO_FILES
34+
$ docker run --rm -v<some-path>:<some-path> -w<some-path> jaegertracing/protobuf [OPTION] PROTO_FILES
4335
```
4436

4537
For help try:
4638
```
47-
$ docker run --rm thethingsindustries/protoc --help
39+
$ docker run --rm jaegertracing/protobuf --help
40+
```
41+
42+
### To generate language specific code
43+
44+
1. Make sure you have the `model.proto` file present in `${PWD}`
45+
46+
2. Use any of the language specific options -
47+
```
48+
--cpp_out=OUT_DIR Generate C++ header and source.
49+
--csharp_out=OUT_DIR Generate C# source file.
50+
--java_out=OUT_DIR Generate Java source file.
51+
--js_out=OUT_DIR Generate JavaScript source.
52+
--objc_out=OUT_DIR Generate Objective C header and source.
53+
--php_out=OUT_DIR Generate PHP source file.
54+
--python_out=OUT_DIR Generate Python source file.
55+
--ruby_out=OUT_DIR Generate Ruby source file.
4856
```
57+
58+
Example for Java:
59+
```
60+
docker run --rm -v${PWD}:{PWD} -w${PWD} jaegertracing/protobuf:latest --proto_path=${PWD} \
61+
--java_out=${PWD} -I/usr/include/github.com/gogo/protobuf ${PWD}/model.proto
62+
```
63+
64+
CLI options:
65+
- `--proto_path`: The path where protoc should search for proto files
66+
- `--java_out` : Generate Java code in the provided path

check-versions.go

Lines changed: 0 additions & 94 deletions
This file was deleted.

go.mod

Lines changed: 0 additions & 12 deletions
This file was deleted.

go.sum

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)