-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile-proto
44 lines (37 loc) · 1.52 KB
/
Dockerfile-proto
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
FROM golang:1.15
ARG PROTOBUF_VERSION=3.14.0
ARG PHP_GRPC_VERSION=1.34.0
ARG GOLANG_GRPC_VERSION=1.4.3
# Utils
RUN apt-get update
RUN apt-get install unzip
# Protobuf
RUN mkdir -p /protobuf
RUN cd /protobuf \
&& wget https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protoc-${PROTOBUF_VERSION}-linux-x86_64.zip -O protobuf.zip \
&& unzip protobuf.zip && rm protobuf.zip
# grpc PHP (generate client)
RUN apt-get install php php-dev php-pear phpunit zlib1g-dev -y
RUN pecl install grpc-${PHP_GRPC_VERSION}
RUN cd /protobuf && git clone -b v${PHP_GRPC_VERSION} https://github.com/grpc/grpc \
&& cd /protobuf/grpc && git submodule update --init
RUN apt-get install autoconf libtool automake build-essential -y
RUN cd /protobuf/grpc && make grpc_php_plugin
# RoadRunner's custom PHP gRPC plugin (server interface definition)
RUN apt-get install -y git
RUN git clone https://github.com/spiral/php-grpc.git
RUN cd php-grpc/cmd/rr-grpc && go install
RUN cd php-grpc/cmd/protoc-gen-php-grpc && go install
# grpc Go
RUN mkdir -p /mock-go-module
RUN cd /mock-go-module \
&& go mod init mockmodule \
&& go get github.com/golang/protobuf/protoc-gen-go@v${GOLANG_GRPC_VERSION} \
&& go get -u github.com/golang/protobuf/protoc-gen-go
# grpc-gateway
RUN cd /mock-go-module \
&& go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-grpc-gateway \
&& go get -u github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger
RUN cd /protobuf \
&& rm -rf /mock-go-module
ENV PATH "/protobuf/bin:${PATH}"