Skip to content

Instantly share code, notes, and snippets.

@cubehouse
Created August 12, 2018 14:30
Show Gist options
  • Save cubehouse/8c37ceae11fab130f9247f8a5e7cbb2b to your computer and use it in GitHub Desktop.
Save cubehouse/8c37ceae11fab130f9247f8a5e7cbb2b to your computer and use it in GitHub Desktop.
Build protobuf files for Dart - Docker image
FROM ubuntu
RUN mkdir /proto
WORKDIR /proto
RUN apt update && apt install apt-transport-https gnupg2 curl unzip wget -y
RUN sh -c 'curl https://dl-ssl.google.com/linux/linux_signing_key.pub | apt-key add -'
RUN sh -c 'curl https://storage.googleapis.com/download.dartlang.org/linux/debian/dart_stable.list > /etc/apt/sources.list.d/dart_stable.list'
RUN apt update && apt install dart -y
RUN wget https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip
RUN unzip protoc-3.6.1-linux-x86_64.zip
RUN /usr/lib/dart/bin/pub global activate protoc_plugin
CMD cp /in/*.proto . && PATH="$PATH":"$HOME/.pub-cache/bin" ./bin/protoc --dart_out=grpc:/out *.proto
@cubehouse
Copy link
Author

Run:

docker build -t protobuffer . && docker run --rm -v /path/to/proto/files/:/in -v /path/to/output/folder/:/out -t protobuffer

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