Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: dockerfile for building proto #11452

Merged
merged 11 commits into from
Mar 25, 2022
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ devdoc-update:
### Protobuf ###
###############################################################################

protoVer=v0.4
protoVer=v0.5
protoImageName=tendermintdev/sdk-proto-gen:$(protoVer)
containerProtoGen=$(PROJECT_NAME)-proto-gen-$(protoVer)
containerProtoGenAny=$(PROJECT_NAME)-proto-gen-any-$(protoVer)
Expand Down
10 changes: 9 additions & 1 deletion client/grpc/reflection/reflection.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 21 additions & 1 deletion client/grpc/tmservice/query.pb.gw.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

35 changes: 21 additions & 14 deletions contrib/devtools/dockerfile
Original file line number Diff line number Diff line change
@@ -1,23 +1,30 @@
FROM bufbuild/buf:1.1.0 as BUILDER

FROM golang:alpine
FROM golang:1.17-alpine

ENV GOLANG_PROTOBUF_VERSION=1.27.1 \
GOGO_PROTOBUF_VERSION=1.3.2 \
GRPC_GATEWAY_VERSION=1.14.7
RUN apk add --no-cache \
nodejs \
npm \
git \
make

ENV GOLANG_PROTOBUF_VERSION=1.28.0 \
GOGO_PROTOBUF_VERSION=1.3.3-alpha.regen.1 \
GRPC_GATEWAY_VERSION=1.16.0

RUN GO111MODULE=on go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest
RUN GO111MODULE=on go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION}
RUN GO111MODULE=on go install github.com/gogo/protobuf/protoc-gen-gogo@v${GOGO_PROTOBUF_VERSION}
RUN GO111MODULE=on go install github.com/gogo/protobuf/protoc-gen-gogofast@v${GOGO_PROTOBUF_VERSION}
RUN GO111MODULE=on go install github.com/gogo/protobuf/protoc-gen-gogofaster@v${GOGO_PROTOBUF_VERSION}
RUN GO111MODULE=on go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION}
RUN GO111MODULE=on go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION}
RUN go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION}
RUN go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v${GRPC_GATEWAY_VERSION} \
github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@v${GRPC_GATEWAY_VERSION}
RUN go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@latest
## For the moment there is a problem with go install and replace, so installing
## by cloninng the repository instead
#RUN go get github.com/regen-network/protobuf/protoc-gen-gogo@v${GOGO_PROTOBUF_VERSION} \
# github.com/regen-network/protobuf/protoc-gen-gogofast@v${GOGO_PROTOBUF_VERSION} \
# github.com/regen-network/protobuf/protoc-gen-gogofaster@v${GOGO_PROTOBUF_VERSION}

RUN git clone https://github.com/regen-network/protobuf.git; cd protobuf; go mod download; make install

RUN apk add --no-cache \
nodejs \
npm

RUN npm install -g swagger-combine

Expand Down
14 changes: 1 addition & 13 deletions scripts/protocgen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,10 @@
# go install github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway@v1.16.0
# go install github.com/cosmos/cosmos-proto/cmd/protoc-gen-go-pulsar@latest
# go get github.com/regen-network/cosmos-proto@latest # doesn't work in install mode
# go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@v0.3.1

set -eo pipefail

protoc_install_gocosmos() {
echo "Installing protobuf gocosmos plugin"
# we should use go install, but regen-network/cosmos-proto contains
# replace directives. It must not contain directives that would cause
# it to be interpreted differently than if it were the main module.
# So the command below issues a warning and we are muting it for now.
#
# Installing plugins must be done outside of the module
(go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@v0.3.1 2> /dev/null)
}

protoc_install_gocosmos

echo "Generating gogo proto code"
cd proto
proto_dirs=$(find ./cosmos -path -prune -o -name '*.proto' -print0 | xargs -0 -n1 dirname | sort | uniq)
Expand Down
Loading