restore Dockerfile

This commit is contained in:
Денис Евстигнеев 2023-08-10 12:44:12 +03:00
parent 92153397a0
commit a0d101e9ce
2 changed files with 50 additions and 0 deletions

View File

@ -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

View File

@ -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