generate protobuf client/server

This commit is contained in:
Ben Grewell
2021-04-01 13:44:30 -07:00
parent 55afe867bd
commit 68d1db633d
5 changed files with 13 additions and 19 deletions

View File

@@ -6,7 +6,7 @@ LABEL maintainer="Benjamin Grewell <bgrewell@gmail.com>"
ENV PROTOC_VERSION 3.6.1
ENV PROTOC_GEN_GO_VERSION v1.2.0
WORKDIR /go/src/github.com/BGrewell/go-iperf/api/proto
WORKDIR /go/src/github.com/BGrewell/go-iperf/api
RUN apt update
RUN apt install -y protobuf-compiler python3 python3-pip
@@ -15,7 +15,7 @@ RUN pip3 install grpcio-tools
RUN export PATH=$PATH:$GOPATH/bin
RUN echo $PATH
COPY proto/control.proto control.proto
COPY proto/control.proto proto/control.proto
RUN mkdir go
RUN protoc -I /. --go_out=plugins=grpc:go control.proto
RUN protoc -I proto/. --go_out=plugins=grpc:go control.proto

4
api/build.sh Normal file → Executable file
View File

@@ -8,14 +8,14 @@ fi
echo "[+] Building docker container"
docker image build -t go-iperf-builder:1.0 .
docker container run --detach --name builder go-iperf-builder:1.0
docker cp grpc:/go/src/github.com/BGrewell/go-iperf/api/go/api.pb.go go/.
docker cp builder:/go/src/github.com/BGrewell/go-iperf/api/go/github.com/BGrewell/go-iperf/api/control.pb.go go/.
echo "[+] Updating of go library complete"
echo "[+] Removing docker container"
docker rm builder
echo "[+] Adding new files to source control"
git add go/api.pb.go
git add go/control.pb.go
git commit -m "regenerated grpc libraries"
git push

View File

@@ -2,6 +2,8 @@ syntax = "proto3";
import "google/protobuf/empty.proto";
option go_package = "github.com/BGrewell/go-iperf/api";
// [START java_declaration]
option java_multiple_files = true;
option java_package = "com.bengrewell.go-iperf.control";