From a0d101e9ce564608f516ffae1e8fb984926bf9cd Mon Sep 17 00:00:00 2001 From: Evstigneev Denis Date: Thu, 10 Aug 2023 12:44:12 +0300 Subject: [PATCH] restore Dockerfile --- proto/docker_generate/Dockerfile | 43 ++++++++++++++++++++++++++++++++ proto/docker_generate/Makefile | 7 ++++++ 2 files changed, 50 insertions(+) create mode 100644 proto/docker_generate/Dockerfile create mode 100644 proto/docker_generate/Makefile diff --git a/proto/docker_generate/Dockerfile b/proto/docker_generate/Dockerfile new file mode 100644 index 0000000..24e0cd6 --- /dev/null +++ b/proto/docker_generate/Dockerfile @@ -0,0 +1,43 @@ +FROM golang:1.19-bullseye + +RUN mkdir /build +WORKDIR /build + +RUN apt-get update && apt-get -y install --no-install-recommends protobuf-compiler libprotobuf-dev + +ENV PATH=${PATH}:${GOBIN} + +ENV GEN_VALIDATE=github.com/envoyproxy/protoc-gen-validate@v1.0.2 +ENV GOOGLEAPIS=github.com/google/googleapis@v0.0.0-20200324113624-36c0febd0fa7 +ENV GRPC_GATEWAY=github.com/grpc-ecosystem/grpc-gateway@v1.16.0 + +RUN go install ${GEN_VALIDATE} + +RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v1.16.0 && \ + go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v1.16.0 && \ + go install google.golang.org/protobuf/cmd/protoc-gen-go@latest + +RUN go install go.unistack.org/protoc-gen-go-micro/v3@latest + +RUN go mod init proto +RUN go get ${GOOGLEAPIS} && \ + go get ${GRPC_GATEWAY} && \ + go get google.golang.org/grpc@v1.57.0 && \ + go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway && \ + go get -u github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 && \ + go get google.golang.org/protobuf/cmd/protoc-gen-go && \ + go get go.unistack.org/micro-proto/v3@v3.3.1 + +CMD rm -rf go_generate && \ + protoc \ + --validate_out=lang=go:. \ + --go-micro_out=debug=true,components="micro|http":. \ + --go_out=. \ + --grpc-gateway_out=. \ + --proto_path=/go/pkg/mod/go.unistack.org/micro-proto/v3@v3.3.1 \ + -I=./ \ + -I=/usr/include \ + -I=/go/pkg/mod/${GEN_VALIDATE} \ + -I=/go/pkg/mod/${GOOGLEAPIS} \ + -I=/go/pkg/mod/${GRPC_GATEWAY} \ + ./*.proto diff --git a/proto/docker_generate/Makefile b/proto/docker_generate/Makefile new file mode 100644 index 0000000..cac80f5 --- /dev/null +++ b/proto/docker_generate/Makefile @@ -0,0 +1,7 @@ +#New version of proto Makefile and Dockerfile can be found +#at https://qcm-git.mbrd.ru/service-platform/examples/makefile + +.PHONY: proto +proto: + docker build -t proto:latest . + docker run --rm --name=proto -v `pwd`:/build proto:latest \ No newline at end of file