diff --git a/.dockerignore b/.dockerignore index 45a6800a..328cc438 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,4 @@ -assets +deployments .git .github *.pb.go \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index 57713a20..2c79da3e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -7,11 +7,12 @@ RUN apk -U --no-cache add bash git protobuf curl &&\ go install -v google.golang.org/protobuf/cmd/protoc-gen-go@latest &&\ go install -v google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest &&\ # cloning well-known-types - # only use needed files git clone --depth=1 https://github.com/protocolbuffers/protobuf.git /protobuf-repo &&\ mv /protobuf-repo/src/ /protobuf/ &&\ - rm -rf /protobuf-repo &&\ + # cloning googleapis-types + git clone --depth=1 https://github.com/googleapis/googleapis.git /googleapis &&\ # cleanup + rm -rf /protobuf-repo &&\ find /protobuf -not -name "*.proto" -type f -delete &&\ apk del git &&\ apk -v cache clean diff --git a/example/well_known_types/wkt.proto b/example/well_known_types/wkt.proto index dfeb3f86..28891bcb 100644 --- a/example/well_known_types/wkt.proto +++ b/example/well_known_types/wkt.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package well_known_types; +import "google/api/annotations.proto"; import "google/protobuf/empty.proto"; import "google/protobuf/api.proto"; @@ -10,5 +11,10 @@ service Gripmock { // this shows us example on using WKT as dependency // api.proto in particular has go_package alias with semicolon // "google.golang.org/genproto/protobuf/api;api" - rpc ApiInfo(google.protobuf.Empty) returns (google.protobuf.Api); + rpc ApiInfo(google.protobuf.Empty) returns (google.protobuf.Api) { + option (google.api.http) = { + post: "/v1/gripmock/api-info" + body: "*" + }; + } } diff --git a/gripmock.go b/gripmock.go index 0ba40351..14435221 100644 --- a/gripmock.go +++ b/gripmock.go @@ -28,7 +28,7 @@ func main() { adminport := flag.String("admin-port", "4771", "Port of stub admin server") adminBindAddr := flag.String("admin-listen", "0.0.0.0", "Adress the admin server will bind to. Default to localhost, set to 0.0.0.0 to use from another machine") stubPath := flag.String("stub", "", "Path where the stub files are (Optional)") - imports := flag.String("imports", "/protobuf", "comma separated imports path. default path /protobuf is where gripmock Dockerfile install WKT protos") + imports := flag.String("imports", "/protobuf,/googleapis", "comma separated imports path. default path /protobuf,/googleapis is where gripmock Dockerfile install WKT protos") // for backwards compatibility if os.Args[1] == "gripmock" { os.Args = append(os.Args[:1], os.Args[2:]...)