lightning-terminal/litrpc/gen_protos_docker.sh
Oliver Gugger ea33903622
litrpc+proto: fix ownership in docker container
This was discovered while debugging the reproducible build. We used the
wrong group ID. And the environment variables aren't super portable so
we use the correct command to get the numeric user and group IDs.
2024-10-24 11:18:02 +02:00

22 lines
675 B
Bash
Executable file

#!/bin/bash
set -e
# Directory of the script file, independent of where it's called from.
DIR="$(cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd)"
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)
echo "Building protobuf compiler docker image..."
docker build -t lit-protobuf-builder \
--build-arg PROTOBUF_VERSION="$PROTOBUF_VERSION" \
--build-arg GRPC_GATEWAY_VERSION="$GRPC_GATEWAY_VERSION" \
.
echo "Compiling and formatting *.proto files..."
docker run \
--rm \
--user $(id -u):$(id -g) \
-v "$DIR/../:/build" \
lit-protobuf-builder