|
1 | | -FROM golang:1.11-alpine AS build |
2 | | -ARG PROTOTOOL_VERSION=1.3.0 |
3 | | -ARG PROTOC_VERSION=3.6.1 |
4 | | -ARG PROTOC_GEN_GO_VERSION=1.2.0 |
5 | | -ARG PROTOC_GEN_GOGO_VERSION=1.1.1 |
6 | | -ARG PROTOC_GEN_JAVA_GRPC_VERSION=1.16.1 |
7 | | -ARG PROTOC_GEN_VALIDATE_VERSION=0.0.10 |
8 | | - |
9 | | -RUN apk --no-cache add --update curl git libc6-compat make |
10 | | -RUN \ |
11 | | - curl -sSL https://github.com/uber/prototool/releases/download/v$PROTOTOOL_VERSION/prototool-Linux-x86_64 -o /bin/prototool && \ |
12 | | - chmod +x /bin/prototool |
13 | | -RUN \ |
14 | | - mkdir /tmp/prototool-bootstrap && \ |
15 | | - echo $'protoc:\n version:' $PROTOC_VERSION > /tmp/prototool-bootstrap/prototool.yaml && \ |
16 | | - echo 'syntax = "proto3";' > /tmp/prototool-bootstrap/tmp.proto && \ |
17 | | - prototool compile /tmp/prototool-bootstrap && \ |
18 | | - rm -rf /tmp/prototool-bootstrap |
19 | | -RUN go get github.com/golang/protobuf/... && \ |
20 | | - cd /go/src/github.com/golang/protobuf && \ |
21 | | - git checkout v$PROTOC_GEN_GO_VERSION && \ |
22 | | - go install ./protoc-gen-go |
23 | | -RUN go get github.com/gogo/protobuf/... && \ |
24 | | - cd /go/src/github.com/gogo/protobuf && \ |
25 | | - git checkout v$PROTOC_GEN_GOGO_VERSION && \ |
26 | | - go install ./protoc-gen-gogofast ./protoc-gen-gogofaster ./protoc-gen-gogoslick |
27 | | -RUN go get -d github.com/lyft/protoc-gen-validate && \ |
28 | | - cd /go/src/github.com/lyft/protoc-gen-validate && \ |
29 | | - git checkout v$PROTOC_GEN_VALIDATE_VERSION && \ |
30 | | - make build |
31 | | -RUN curl -sSL https://search.maven.org/remotecontent?filepath=io/grpc/protoc-gen-grpc-java/$PROTOC_GEN_JAVA_GRPC_VERSION/protoc-gen-grpc-java-$PROTOC_GEN_JAVA_GRPC_VERSION-linux-x86_64.exe -o /bin/protoc-gen-grpc-java && \ |
32 | | - chmod +x /bin/protoc-gen-grpc-java |
33 | | - |
34 | | -FROM alpine:3.8 |
35 | | -WORKDIR /in |
36 | | -RUN apk --no-cache add --update libc6-compat |
37 | | -COPY --from=build /bin/prototool /bin/prototool |
38 | | -COPY --from=build /root/.cache/prototool /.cache/prototool |
39 | | -COPY --from=build /go/bin/protoc-gen-go /bin/protoc-gen-go |
40 | | -COPY --from=build /go/bin/protoc-gen-gogofast /bin/protoc-gen-gogofast |
41 | | -COPY --from=build /go/bin/protoc-gen-gogofaster /bin/protoc-gen-gogofaster |
42 | | -COPY --from=build /go/bin/protoc-gen-gogoslick /bin/protoc-gen-gogoslick |
43 | | -COPY --from=build /go/bin/protoc-gen-validate /bin/protoc-gen-validate |
44 | | -COPY --from=build /go/src/github.com/lyft/protoc-gen-validate/validate /include/validate |
45 | | -COPY --from=build /bin/protoc-gen-grpc-java /bin/protoc-gen-grpc-java |
46 | | - |
47 | | -RUN chmod -R 755 /.cache |
48 | | -ENTRYPOINT ["/bin/prototool"] |
| 1 | +FROM golang:1.12.4-alpine3.9 AS build |
49 | 2 |
|
| 3 | +ARG PROTOTOOL_VERSION=1.6.0 |
| 4 | +ARG PROTOC_GEN_JAVA_GRPC_VERSION=1.20.0 |
| 5 | +ARG GOLANG_PROTOBUF_VERSION=1.3.1 |
| 6 | +ARG GOGO_PROTOBUF_VERSION=1.2.1 |
| 7 | +ARG GRPC_GATEWAY_VERSION=1.8.5 |
| 8 | +ARG GRPC_WEB_VERSION=1.0.4 |
50 | 9 |
|
| 10 | +RUN apk --no-cache add --update curl git libc6-compat make upx |
| 11 | + |
| 12 | +RUN GO111MODULE=on go get \ |
| 13 | + github.com/uber/prototool/cmd/prototool@v${PROTOTOOL_VERSION} && \ |
| 14 | + mv /go/bin/prototool /usr/local/bin |
| 15 | + |
| 16 | +RUN GO111MODULE=on go get \ |
| 17 | + github.com/golang/protobuf/protoc-gen-go@v${GOLANG_PROTOBUF_VERSION} \ |
| 18 | + github.com/gogo/protobuf/protoc-gen-gofast@v${GOGO_PROTOBUF_VERSION} \ |
| 19 | + github.com/gogo/protobuf/protoc-gen-gogo@v${GOGO_PROTOBUF_VERSION} \ |
| 20 | + github.com/gogo/protobuf/protoc-gen-gogofast@v${GOGO_PROTOBUF_VERSION} \ |
| 21 | + github.com/gogo/protobuf/protoc-gen-gogofaster@v${GOGO_PROTOBUF_VERSION} \ |
| 22 | + github.com/gogo/protobuf/protoc-gen-gogoslick@v${GOGO_PROTOBUF_VERSION} && \ |
| 23 | + mv /go/bin/protoc-gen-go* /usr/local/bin/ |
| 24 | + |
| 25 | +RUN go get -d github.com/gogo/protobuf/gogoproto && \ |
| 26 | + mkdir -p /usr/include/gogoproto && \ |
| 27 | + mv /go/src/github.com/gogo/protobuf/gogoproto/gogo.proto /usr/include/gogoproto/gogo.proto |
| 28 | + |
| 29 | +RUN curl -sSL \ |
| 30 | + https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v${GRPC_GATEWAY_VERSION}/protoc-gen-grpc-gateway-v${GRPC_GATEWAY_VERSION}-linux-x86_64 \ |
| 31 | + -o /usr/local/bin/protoc-gen-grpc-gateway && \ |
| 32 | + curl -sSL \ |
| 33 | + https://github.com/grpc-ecosystem/grpc-gateway/releases/download/v${GRPC_GATEWAY_VERSION}/protoc-gen-swagger-v${GRPC_GATEWAY_VERSION}-linux-x86_64 \ |
| 34 | + -o /usr/local/bin/protoc-gen-swagger && \ |
| 35 | + chmod +x /usr/local/bin/protoc-gen-grpc-gateway && \ |
| 36 | + chmod +x /usr/local/bin/protoc-gen-swagger |
| 37 | + |
| 38 | +RUN curl -sSL \ |
| 39 | + https://github.com/grpc/grpc-web/releases/download/${GRPC_WEB_VERSION}/protoc-gen-grpc-web-${GRPC_WEB_VERSION}-linux-x86_64 \ |
| 40 | + -o /usr/local/bin/protoc-gen-grpc-web && \ |
| 41 | + chmod +x /usr/local/bin/protoc-gen-grpc-web |
| 42 | + |
| 43 | +RUN go get -d github.com/envoyproxy/protoc-gen-validate && \ |
| 44 | + cd /go/src/github.com/envoyproxy/protoc-gen-validate && \ |
| 45 | + make build && \ |
| 46 | + mv /go/bin/protoc-gen-validate /usr/local/bin && \ |
| 47 | + mkdir -p /usr/include/validate && \ |
| 48 | + mv /go/src/github.com/envoyproxy/protoc-gen-validate/validate/validate.proto /usr/include/validate/validate.proto |
| 49 | + |
| 50 | +RUN curl -sSL https://search.maven.org/remotecontent?filepath=io/grpc/protoc-gen-grpc-java/$PROTOC_GEN_JAVA_GRPC_VERSION/protoc-gen-grpc-java-$PROTOC_GEN_JAVA_GRPC_VERSION-linux-x86_64.exe -o /usr/local/bin/protoc-gen-grpc-java && \ |
| 51 | + chmod +x /usr/local/bin/protoc-gen-grpc-java |
| 52 | + |
| 53 | +RUN upx --lzma /usr/local/bin/* |
| 54 | + |
| 55 | +FROM alpine:3.9 |
| 56 | +ENV PROTOTOOL_CACHE_PATH=/tmp |
| 57 | +ENV LD_LIBRARY_PATH=/lib64:/lib |
| 58 | +WORKDIR /work |
| 59 | +RUN apk --no-cache add --update ca-certificates libc6-compat |
| 60 | +COPY --from=build /usr/local/bin /usr/local/bin |
| 61 | +COPY --from=build /usr/include /usr/include |
| 62 | +RUN chmod -R 755 /usr/include |
0 commit comments