-
Notifications
You must be signed in to change notification settings - Fork 409
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
Containerized Protobuf generation #304
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
15238cc
Docker container based Protobuf generation and linting
alpe 02948d3
Add protobuf comments
alpe 0492b4d
Update contrib/prototools-docker/Dockerfile
alpe b925871
Update contrib/prototools-docker/Dockerfile
alpe 668117c
Update x/wasm/internal/types/msg.proto
alpe cccd69a
Update x/wasm/internal/types/types.proto
alpe File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
FROM golang:1.15.3-alpine3.12 AS build | ||
|
||
#ARG PROTOTOOL_VERSION=1.10.0 | ||
ARG PROTODOC_VERSION=1.3.2 | ||
ARG GRPC_GATEWAY_VERSION=1.16.0 | ||
ARG REGEN_GOGOPROTO_VERSION=0.3.0 | ||
ARG REGEN_PROTOBUF_VERSION=1.3.2-alpha.regen.4 | ||
ARG BUF_VERSION=0.30.0 | ||
|
||
RUN apk --no-cache add --update curl git libc6-compat make upx | ||
|
||
RUN go get -d \ | ||
github.com/gogo/protobuf/gogoproto && \ | ||
mkdir -p /usr/include/google/protobuf/ && \ | ||
mv /go/src/github.com/gogo/protobuf/protobuf/google/protobuf/empty.proto /usr/include/google/protobuf/ && \ | ||
mv /go/src/github.com/gogo/protobuf/protobuf/google/protobuf/descriptor.proto /usr/include/google/protobuf/ | ||
|
||
RUN GO111MODULE=on go get \ | ||
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} && \ | ||
mv /go/bin/protoc-gen-grpc-gateway /usr/local/bin/ && \ | ||
mv /go/bin/protoc-gen-swagger /usr/local/bin/ | ||
|
||
# Install regen fork of gogo proto | ||
# To install a fix version this can only be done via this go.mod workaround | ||
WORKDIR /work | ||
RUN GO111MODULE=on go mod init foobar && \ | ||
go mod edit -replace github.com/gogo/protobuf=github.com/regen-network/protobuf@v${REGEN_PROTOBUF_VERSION} && \ | ||
go get github.com/regen-network/cosmos-proto/protoc-gen-gocosmos@v${REGEN_GOGOPROTO_VERSION} && \ | ||
mv /go/bin/protoc-gen-gocosmos* /usr/local/bin/ | ||
|
||
RUN GO111MODULE=on go get \ | ||
github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@v${PROTODOC_VERSION} && \ | ||
mv /go/bin/protoc-gen-doc /usr/local/bin/ | ||
|
||
RUN GO111MODULE=on go get \ | ||
github.com/bufbuild/buf/cmd/buf@v${BUF_VERSION} && \ | ||
mv /go/bin/buf /usr/local/bin/ | ||
|
||
RUN upx --lzma /usr/local/bin/* | ||
|
||
FROM golang:1.15.3-alpine3.12 | ||
ENV LD_LIBRARY_PATH=/lib64:/lib | ||
|
||
WORKDIR /work | ||
RUN apk --no-cache add --update curl git libc6-compat make | ||
RUN apk --no-cache add --update ca-certificates libc6-compat protoc | ||
|
||
COPY --from=build /usr/local/bin /usr/local/bin | ||
COPY --from=build /usr/include /usr/include | ||
RUN chmod -R 755 /usr/include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Prototool Docker Helper | ||
======================= | ||
Docker container for all the protobuf generation... | ||
|
||
Based on the work by @pseudomuto [prototool-docker](https://github.com/charithe/prototool-docker) project: | ||
|
||
Installs generators and tools from: | ||
|
||
* https://github.com/bufbuild/buf | ||
* https://github.com/grpc-ecosystem | ||
* https://github.com/regen-network/cosmos-proto | ||
* https://github.com/pseudomuto/protoc-gen-doc | ||
|
||
### Build | ||
```shell script | ||
docker build -t cosmwasm/prototools-docker -f ./contrib/prototools-docker/Dockerfile . | ||
``` | ||
|
||
```shell script | ||
docker run -it -v $(go list -f "{{ .Dir }}" -m github.com/cosmos/cosmos-sdk):/workspace/cosmos_sdk_dir -v $(pwd):/workspace --workdir /workspace --env COSMOS_SDK_DIR=/cosmos_sdk_dir cosmwasm/prototool-docker sh | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Generated doc | ||
|
||
Tutorials and project doc is available on https://docs.cosmwasm.com/ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice. Much better maintainable than a one-line .PHONY. Did now know you can specily multiple .PHONY. But people on the internet say this is how you do it (https://stackoverflow.com/questions/4156382/is-it-possible-to-have-multiple-phony-targets-in-a-gnu-makefile)