Swift gRPC works great within Docker.
Follow these steps to build and run Swift gRPC in the Docker container
from swiftdocker.
Run this command on your local system:
docker pull swiftdocker/swift
Start a docker instance with the swiftdocker image:
docker run -it --name swiftgrpc swiftdocker/swift:latest /bin/bash
# update package list
apt-get update
# install a few missing pieces
apt-get install libz-dev unzip
git config --global user.email <your email address>
git config --global user.name "<your name>"
cd
git clone https://github.com/grpc/grpc-swift
cd grpc-swift
make test
cd
cd grpc-swift/Examples/Echo/Swift/SwiftPM
make
# start the server
.build/debug/Echo serve &
# run the client to test each Echo API
.build/debug/Echo get
.build/debug/Echo expand
.build/debug/Echo collect
.build/debug/Echo update
# install protoc
cd
curl -O -L https://github.com/google/protobuf/releases/download/v3.2.0rc2/protoc-3.2.0rc2-linux-x86_64.zip
unzip protoc-3.2.0rc2-linux-x86_64.zip -d /usr
# build the Swift gRPC plugin
cd
cd grpc-swift/Plugin
make
# set environment variables to allow protoc and the plugin to run
export PATH=.:$PATH
# test the plugin by regenerating code for a sample .proto service
make test