GithubHelp home page GithubHelp logo

kobayashirui / docker-protobuf Goto Github PK

View Code? Open in Web Editor NEW

This project forked from jaegertracing/docker-protobuf

0.0 1.0 0.0 824 KB

An all-inclusive protoc Docker image for the Jaeger project

Home Page: https://hub.docker.com/r/jaegertracing/protobuf

License: Apache License 2.0

Shell 12.93% Dockerfile 87.07%

docker-protobuf's Introduction

Protocol Buffers + Docker

A lightweight protoc Docker image, published as jaegertracing/protobuf to Docker Hub, with all dependencies built-in, to generate code in multiple languages. Forked from https://github.com/TheThingsIndustries/docker-protobuf.

Purpose

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.

Contents

Dockerfile configured with dependencies specific to the Jaeger project.

What's included in the image

Supported languages

  • C#
  • C++
  • Go
  • Java / JavaNano (Android)
  • JavaScript
  • Objective-C
  • PHP
  • Python
  • Ruby

Usage

$ docker run --rm -v<some-path>:<some-path> -w<some-path> jaegertracing/protobuf [OPTION] PROTO_FILES

For help try:

$ docker run --rm jaegertracing/protobuf --help

To generate language specific code

  1. Make sure you have the model.proto file present in ${PWD}

  2. Use any of the language specific options -

  --cpp_out=OUT_DIR           Generate C++ header and source.
  --csharp_out=OUT_DIR        Generate C# source file.
  --java_out=OUT_DIR          Generate Java source file.
  --js_out=OUT_DIR            Generate JavaScript source.
  --objc_out=OUT_DIR          Generate Objective C header and source.
  --php_out=OUT_DIR           Generate PHP source file.
  --python_out=OUT_DIR        Generate Python source file.
  --ruby_out=OUT_DIR          Generate Ruby source file.

Example for Java:

docker run --rm -u $(id -u) -v${PWD}:${PWD} -w${PWD} jaegertracing/protobuf:latest --proto_path=${PWD} \
    --java_out=${PWD} -I/usr/include/github.com/gogo/protobuf ${PWD}/model.proto

CLI options:

  • --proto_path: The path where protoc should search for proto files
  • --java_out : Generate Java code in the provided path

Generate dependencies

The generated code might require dependencies on packages like GoGo or Swagger. The code for these modules can be also generated by using this docker image:

docker run --rm -u $(id -u) -v${PWD}:${PWD} -w${PWD} jaegertracing/protobuf:latest --proto_path=${PWD} \
    --java_out=${PWD} /usr/include/github.com/gogo/protobuf/gogoproto/gogo.proto

Use this command to find the path to proto files included in the image:

docker run --rm -it --entrypoint=/bin/sh jaegertracing/protobuf:latest -c "find /usr/include -name *.proto"

docker-protobuf's People

Contributors

rvolosatovs avatar steeve avatar quentinperez avatar annanay25 avatar moul avatar johanstokking avatar pavolloffay avatar yurishkuro avatar htdvisser avatar falco20019 avatar cerisier avatar erwinvaneyk avatar joe-elliott avatar krishnaiyer avatar kanziw avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.