pkgdash/proto/docker_generate/Dockerfile

44 lines
1.5 KiB
Docker

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