-
Notifications
You must be signed in to change notification settings - Fork 378
Generating Go Bindings with Docker #181
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
Generating Go Bindings with Docker #181
Conversation
Does it take the spec.md (markdown) and spit out the proto file? If it does, that is super cool |
No, it spits out the Go bindings. I can enhance it to spit out various pieces depending on flags, but by default, since it’s named “csi/golang”, it emits the Go bindings. FWIW, the PR States it emits the Go bindings. |
Sorry, yeah, i meant go bindings. |
This patch introduces the ability to generate Go language bindings using Docker with `Dockerfile-go` and a spec file provided at runtime: # builds the container image $ docker build -t csi/golang -f Dockerfile-go . # emits the go bindings to stdout $ cat spec.md | docker run -i csi/golang If the image is run without content available on STDIN then the following error is emitted. $ docker run csi/golang usage: cat spec.md | docker run -i golang/csi $ docker run -i csi/golang usage: cat spec.md | docker run -i golang/csi The image can also be used to emit the generated protobuf instead of the golang bindings: # emits the protobuf to stdout $ cat spec.md | docker run -i csi/golang proto
81fc48a
to
1f2440e
Compare
Ha! I'm glad you mistyped it, because I just rebased this PR and now it can emit the protobuf as well, just add the command cat spec.md | docker run -i csi/golang proto |
Hi @saad-ali, Would you, @jieyu, @julian-hj, and @cpuguy83 please review and approve (or not) this PR? Even if it's not yet in the build pipeline, this PR provides a very simple, standard way for people to generate the bindings locally. |
exit 1 | ||
fi | ||
|
||
while IFS= read -r line; do |
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.
could we replace this while
loop with a simple cat >> csi.spec
?
@@ -0,0 +1,69 @@ | |||
FROM golang:1.9.3-alpine as build |
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.
why is this dockerfile at the root of the repo, instead of in the lib/go subtree?
We should do this at some point though. |
Per https://github.com/container-storage-interface/community/blob/master/governance.md#pull-request-rot closing PR marked as rotten. |
This patch replaces #180 and introduces the ability to generate Go language bindings using Docker with
Dockerfile-go
and a spec file provided at runtime:Error Handling
If the image is run without content available on STDIN then the following error is emitted:
Emit the Protobuf
The image can also be used to emit the generated protobufs as well, just add the token
proto
at the end of the command used to generate the Go bindings:Image Size
Due to the usage of build stages, the size of the final image is only 25MB!
Docker Hub (
akutz/csi-golang
)As I lack the ability to push to the Docker hub for the
csi
organization, I've pushed the image to the Docker hub asakutz/csi-golang
. Please give it a whirl!cc @saad-ali @cpuguy83