This repository has been archived by the owner on Sep 10, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDockerfile
69 lines (55 loc) · 1.95 KB
/
Dockerfile
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
FROM bufbuild/buf
## See release page. https://github.com/protocolbuffers/protobuf/releases
ENV PROTOBUF_VERSION=3.20.1
####
## download protoc
## https://github.com/protocolbuffers/protobuf/blob/master/src/README.md
####
WORKDIR /home
RUN set -eux && \
apk add --update git curl autoconf automake libtool g++ unzip make && \
curl -L -o /home/protobuf.tar.gz https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOBUF_VERSION}/protobuf-cpp-${PROTOBUF_VERSION}.tar.gz && \
tar -zxvf protobuf.tar.gz
WORKDIR /home/protobuf-${PROTOBUF_VERSION}
####
## install protoc
####
RUN set -eux && \
./autogen.sh && \
./configure && \
make -j 3 && \
make install
####
## install golang (its dependency is included gcc)
####
RUN apk add --update --no-cache \
ca-certificates curl go
####
## install golang plugin of protobuf, protoc-gen-go (API v2), protoc-gen-go-grpc (API v2) and protoc-gen-doc
####
ENV GOPATH /go
ENV PATH $GOPATH/bin:$PATH
RUN mkdir -p "$GOPATH/src" "$GOPATH/bin" && chmod -R 777 "$GOPATH"
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@latest && \
go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@latest && \
go install github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc@latest && \
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@latest && \
go install github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@latest
####
## install typescript plugin of protobuf
####
WORKDIR /home
RUN apk add --update --no-cache \
npm
# If you use @protobuf-ts, remove this comment out
# RUN npm install @protobuf-ts/plugin
# ENV PATH /home/node_modules/@protobuf-ts/plugin/bin:$PATH
RUN npm install --save \
ts-protoc-gen \
google-protobuf \
@types/google-protobuf \
@improbable-eng/grpc-web \
@grpc/grpc-js \
grpc_tools_node_protoc_ts
ENV PATH /home/node_modules/grpc_tools_node_protoc_ts/bin:$PATH
ENTRYPOINT ["/usr/local/bin/buf"]