2021-01-15 13:44:50 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
# Directory of the script file, independent of where it's called from.
|
|
|
|
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
|
|
|
|
|
2021-07-27 12:59:59 +02:00
|
|
|
PROTOBUF_VERSION=$(go list -f '{{.Version}}' -m google.golang.org/protobuf)
|
|
|
|
GRPC_GATEWAY_VERSION=$(go list -f '{{.Version}}' -m github.com/grpc-ecosystem/grpc-gateway/v2)
|
2021-01-15 13:44:50 +01:00
|
|
|
|
|
|
|
echo "Building protobuf compiler docker image..."
|
2021-02-01 19:02:36 +01:00
|
|
|
docker build -t lnd-protobuf-builder \
|
2021-07-27 12:59:59 +02:00
|
|
|
--build-arg PROTOBUF_VERSION="$PROTOBUF_VERSION" \
|
2021-01-15 13:44:50 +01:00
|
|
|
--build-arg GRPC_GATEWAY_VERSION="$GRPC_GATEWAY_VERSION" \
|
|
|
|
.
|
|
|
|
|
|
|
|
echo "Compiling and formatting *.proto files..."
|
|
|
|
docker run \
|
|
|
|
--rm \
|
|
|
|
--user "$UID:$(id -g)" \
|
|
|
|
-e UID=$UID \
|
2021-01-15 13:44:54 +01:00
|
|
|
-e COMPILE_MOBILE \
|
2021-04-06 12:52:27 +02:00
|
|
|
-e SUBSERVER_PREFIX \
|
2021-01-15 13:44:50 +01:00
|
|
|
-v "$DIR/../:/build" \
|
|
|
|
lnd-protobuf-builder
|