Always up-to-date Docker image with protoc and the dart-protoc-plugin
7.6K
Docker image with protoc and the dart-protoc-plugin.
INFO This image contains the null-safe version of the dart-protoc-plugin (20.0.0 or higher) and is updated automatically. A nightly build job checks for new versions of dart, protoc and the dart-protoc-plugin every day.
GitHub: github.com/robojones/protoc-dart
Consider you have a project structure like this:
my-project
|- lib
| |- src
| | |- generated <- the generated protobuf libraries will be here
| | |...
| |
| |- my-project.dart
|
|- protos
| |- api_spec.proto <- we want to compile this
|
|- pubspec.yaml
|...
We want to compile the protos/api_spec.proto and write the output files to the lib/src/generated directory.
This can be done using the following command:
docker run --rm -v=${PWD}:/project robojones/protoc-dart:latest protoc -I=protos --dart_out=lib/src/generated protos/api_spec.proto
That's a really long command – Let's break this down!
docker run --rm -v=${PWD}:/project
robojones/protoc-dart:latest
-I=protos tells protoc that protos/ is the root directory for our *.proto files.
--dart_out=lib/src/generated means that we want our output files to be in the Dart language
and that it should write those files into lib/src/generated.
The last parameter, protos/api_spec.proto, tells protoc that we want to compile that specific file.
protoc -I=protos --dart_out=lib/src/generated protos/api_spec.proto
This repository (build script, Dockerfile, etc.) is published unter the MIT license. This project is not affiliated with the owners and publishers of protoc, the dart docker image or the protoc-plugin-dart plugin. Please inform yourself regarding the license terms of protoc, the dart docker image and the protoc-plugin-dart plugin. Their sources can be found here:
Content type
Image
Digest
sha256:8f8f611f3…
Size
295.9 MB
Last updated
over 1 year ago
docker pull robojones/protoc-dart