I'd like to create a docker container that can read file named helloworld.proto and run command
protoc --dart_out=grpc:lib/src/generated -Iprotos protos/helloworld.proto
The container would start with all the dependencies and generate required file using gRPC which is accessible by the HOST machine. Is this achievable?
If the primary goal of your process is to read a file from the host system and write a file back to the host system, you will find it much easier to run the process directly on the host system and not involve Docker.
You can in principle use Docker bind mounts to make a host directory visible to the container. Especially for a one-off command, though, the length of the command line required to start the container will be longer than the length of the command you're trying to run:
It will usually be a single command (
sudo apt-get install protobuf-compiler
,brew install protobuf
) to getprotoc
installed globally on your host system and that will usually be easier to manage.