forked from robbydyer/sports
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Dockerfile.protoc
52 lines (41 loc) · 2.03 KB
/
Dockerfile.protoc
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
FROM alpine:3.17.0 as base
RUN echo "@edge-testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && \
apk --update --no-cache add \
rsync \
protoc=3.21.9-r0 \
protobuf=3.21.9-r0 \
protobuf-dev=3.21.9-r0 \
nodejs \
alpine-sdk \
bash \
bazel4@edge-testing \
build-base \
git
FROM golang:1.19.4 as builder
ARG CGO_ENABLED=0
ARG GOOS=linux
ARG GOARCH=amd64
ARG GO111MODULE=on
COPY . /src
RUN cd /src && go build -mod=vendor -o /tmp/protoc-gen-go ./vendor/google.golang.org/protobuf/cmd/protoc-gen-go
#RUN cd /src && go build -mod=vendor -o /tmp/protoc-gen-go-grpc ./vendor/google.golang.org/grpc/cmd/protoc-gen-go-grpc
RUN cd /src && go build -mod=vendor -o /tmp/protoc-gen-twirp ./vendor/github.com/twitchtv/twirp/protoc-gen-twirp
RUN cd /src && go build -mod=vendor -o /tmp/protoc-gen-doc ./vendor/github.com/pseudomuto/protoc-gen-doc/cmd/protoc-gen-doc
RUN cd /src && go build -mod=vendor -o /tmp/protoc-gen-openapiv2 ./vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2
RUN cd /src && go build -mod=vendor -o /tmp/protoc-gen-gotag ./vendor/github.com/srikrsna/protoc-gen-gotag
# This lib doesn't support Twirp v7
#RUN cd /src && go build -mod=vendor -o /tmp/protoc-gen-twirp_js ./vendor/github.com/thechriswalker/protoc-gen-twirp_js
FROM base
# Install the javascript crap
RUN git clone --branch v3.21.2 https://github.com/protocolbuffers/protobuf-javascript && \
cd protobuf-javascript && \
bazel build plugin_files && \
install -o root -g root -m 0755 bazel-bin/generator/protoc-gen-js -t /usr/bin
COPY vendor/github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2 /tmp/protoc-gen-openapiv2
RUN rsync -av --include="*/" --include "*.proto" --exclude="*" /tmp/protoc-gen-openapiv2 /usr/include/
RUN rm -rf /tmp/protoc-gen-openapiv2
COPY --from=builder /tmp/protoc-gen-* /usr/bin/
#ADD https://github.com/grpc/grpc-web/archive/refs/tags/1.2.1.tar.gz /tmp/
#RUN cd /tmp && tar xzf /tmp/1.2.1.tar.gz && \
# cd /tmp/grpc-web-1.2.1 && \
# make install-plugin