Skip to content

Instantly share code, notes, and snippets.

@anxiousmodernman
Last active July 26, 2017 19:11
Show Gist options
  • Save anxiousmodernman/cc319ff044b950599397fe90e81d7dfb to your computer and use it in GitHub Desktop.
Save anxiousmodernman/cc319ff044b950599397fe90e81d7dfb to your computer and use it in GitHub Desktop.
Dockerized protoc compiler example

What is going on here

It has been difficult to build protos.pb.go files locally

Run setup.sh to build the docker container used to generate the PB files Make some changes to any of the .proto files Run build.sh to generate protoactor-go useable output profit

Could probably use a makefile but maybe later

#!/bin/bash
docker run -v `pwd`:/defs pbmaker
FROM golang:1.8.3-jessie
RUN apt-get update -qq
RUN apt-get install -y zip git
RUN mkdir -p $GOPATH/src/github.com/AsynkronIT/
RUN cd $GOPATH/src/github.com/AsynkronIT/ && git clone https://github.com/AsynkronIT/protoactor-go.git
RUN curl -L 'https://github.com/google/protobuf/releases/download/v3.2.0/protoc-3.2.0-linux-x86_64.zip' > proto.zip
RUN unzip proto.zip
RUN export PATH=$PATH:$(pwd)/bin
RUN go get -u github.com/golang/protobuf/proto
RUN go get -u github.com/golang/protobuf/protoc-gen-go
RUN go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway
RUN cd $GOPATH/src/github.com/AsynkronIT/protoactor-go && sh updateproto.bat
WORKDIR /defs
ENTRYPOINT ["protoc", "-I=.", "-I=/go/src", "--gogoslick_out=plugins=grpc:.", "* .proto"]
#!/bin/bash
docker build . -t pbmaker
@anxiousmodernman
Copy link
Author

This is the work of @Nowfred

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment