Docker image does not work
opened this issue · comments
I tried to setup a container running letmegrpc, with the following Dockerfile
FROM golang:latest
# install protobuf
RUN apt-get update && apt-get install curl unzip -y
RUN curl -OL https://github.com/google/protobuf/releases/download/v3.0.0/protoc-3.0.0-linux-x86_64.zip \
&& unzip protoc-3.0.0-linux-x86_64.zip -d protoc3 \
&& mv protoc3/bin/protoc /usr/bin/protoc
# install letmegrpc
RUN cd $GOPATH \
&& mkdir -p ./src/github.com/gogo/letmegrpc \
&& git clone https://github.com/gogo/letmegrpc ./src/github.com/gogo/letmegrpc \
&& git clone https://github.com/gogo/protobuf ./src/github.com/gogo/protobuf \
&& go get google.golang.org/grpc \
&& go get golang.org/x/net/context \
&& (cd ./src/github.com/gogo/letmegrpc && make install)
# install protoc-gen-gogo
RUN go get github.com/gogo/protobuf/protoc-gen-gofast \
&& go get github.com/gogo/protobuf/proto \
&& go get github.com/gogo/protobuf/jsonpb \
&& go get github.com/gogo/protobuf/protoc-gen-gogo \
&& go get github.com/gogo/protobuf/gogoproto
COPY protos /etc/protos
EXPOSE 5000
CMD letmegrpc --addr=localhost:3002 --port=5000 --proto_path=/etc/protos /etc/protos/auth.proto
I tried to run it using docker run -it -p 5000:5000 letmegrpc:auth
, The process run without any errors, but http://localhost:5000/MyService/MyMethod still cannot be reached, any idea where the issues are? Thanks in advance!
Hmmm, I should have done this a long time ago. Great idea.
Would you mind trying rather using the customized work flow
https://github.com/gogo/letmegrpc#customization
It requires a little extra work, but using the letmegrpc
command is just a small hack just to quickly show you have it could work.
Here you can see it calling the protoc commands as well
https://github.com/gogo/letmegrpc/blob/master/main.go#L92-L93
followed by the hackily generated main.go file to hook everything up.
Maybe you could also first try expose 3002 and maybe make -addr=0.0.0.0:3002
?
But that is just my noob docker guess.
Thanks for the response! It ends up been an issue on my local machine, the image worked after I restart my local machine
That is great news. Thanks for letting us know and now we have a docker recipe as well.
Thanks so much :)