1
+ # Copyright 2022
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
14
+
1
15
# ###############################################################################
2
16
# Image of a machine with installed swagger-combine and starport.
3
17
# ###############################################################################
4
18
5
- FROM node
6
-
7
- # Install golang
8
- ARG GO_VERSION
9
- ENV GO_VERSION=${GO_VERSION:-1.17.2}
10
- ENV BASH_ENV=/etc/bashrc
11
- ENV PATH="${PATH}:/usr/local/go/bin"
12
- RUN curl -L https://golang.org/dl/go${GO_VERSION}.linux-amd64.tar.gz -o /tmp/go.tar.gz \
13
- && rm -rf /usr/local/go \
14
- && tar -C /usr/local -xzf /tmp/go.tar.gz \
15
- && go version \
16
- && rm -f /tmp/go.tar.gz
17
-
18
- # Install protoc
19
- ARG PROTOC_VERSION
20
- ENV PROTOC_VERSION=${PROTOC_VERSION:-3.19.4}
21
- RUN PROTOC_ZIP=protoc-${PROTOC_VERSION}-linux-x86_64.zip \
22
- && curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/${PROTOC_ZIP} \
23
- && unzip -o $PROTOC_ZIP -d /usr/local bin/protoc \
24
- && unzip -o $PROTOC_ZIP -d /usr/local 'include/*' \
25
- && rm -f $PROTOC_ZIP
26
-
27
- # Install grpc-gateway tools
28
- ENV PROTOC_GEN_GRPC_GATEWAY_VERSION=v2.8.0
29
- ENV PROTOC_GEN_OPENAPIV2_VERSION=v2.8.0
30
- ENV PROTOC_GEN_SWAGGER_VERSION=v1.16.0
19
+ FROM alpine:3.15 as builder
31
20
32
- RUN go install \
33
- github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${PROTOC_GEN_GRPC_GATEWAY_VERSION} \
34
- github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@${PROTOC_GEN_OPENAPIV2_VERSION}
35
-
36
- RUN go install \
37
- github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@${PROTOC_GEN_SWAGGER_VERSION}
21
+ ARG STARPORT_VERSION
38
22
39
- RUN npm install -g swagger-combine
23
+ ENV STARPORT_VERSION=${STARPORT_VERSION:-v0.19.3}
24
+ # ENV STARPORT_VERSION=${STARPORT_VERSION:-dev}
40
25
26
+ RUN apk --no-cache add \
27
+ make=4.3-r0 \
28
+ go=1.17.4-r0 \
29
+ git=2.34.1-r0 \
30
+ bash=5.1.16-r0
41
31
42
32
# Install starport
43
- ARG STARPORT_VERSION
44
- ENV STARPORT_VERSION=${STARPORT_VERSION:-0.19.3}
45
- # ENV STARPORT_VERSION=${STARPORT_VERSION:-dev}
33
+ WORKDIR /tmp
34
+ RUN git clone https://github.com/tendermint/starport.git \
35
+ && if [ "$STARPORT_VERSION" != "dev" ]; then \
36
+ git -C /tmp/starport checkout -b ${STARPORT_VERSION:-v0.19.3} tags/${STARPORT_VERSION:-v0.19.3}; \
37
+ fi \
38
+ && make -C /tmp/starport build
46
39
47
- RUN if [ "$STARPORT_VERSION" = "dev" ]; then \
48
- curl -L https://github.com/tendermint/starport/archive/refs/heads/develop.zip -o /tmp/starport.zip && \
49
- cd /tmp \
50
- && unzip starport.zip \
51
- && cd starport-develop \
52
- && make build \
53
- && cp ./dist/starport /usr/local/bin; \
54
- else \
55
- curl https://get.starport.network/starport@v${STARPORT_VERSION}! -o /tmp/startport \
56
- && bash /tmp/startport \
57
- && rm /tmp/startport; \
58
- fi
40
+ FROM alpine:3.15
59
41
42
+ ENV PROTOC_GEN_GRPC_GATEWAY_VERSION=v2.8.0
43
+ ENV PROTOC_GEN_OPENAPIV2_VERSION=v2.8.0
44
+ ENV PROTOC_GEN_SWAGGER_VERSION=v1.16.0
60
45
ENV PATH="/root/go/bin:${PATH}"
61
- ENV PATH="${PATH}:/usr/local/bin"
62
46
63
- WORKDIR /dcl
47
+ COPY --from=builder /tmp/starport/dist/starport /usr/local/bin/starport
48
+
49
+ RUN apk --no-cache add \
50
+ bash=5.1.16-r0 \
51
+ git=2.34.1-r0 \
52
+ go=1.17.4-r0 \
53
+ protobuf=3.18.1-r1 \
54
+ protobuf-dev=3.18.1-r1 \
55
+ npm=8.1.3-r0 \
56
+ && npm install -g swagger-combine@1.4.0
57
+
58
+ # Install grpc-gateway tools
59
+
60
+ RUN go install \
61
+ github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway@${PROTOC_GEN_GRPC_GATEWAY_VERSION} \
62
+ github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-openapiv2@${PROTOC_GEN_OPENAPIV2_VERSION} \
63
+ && go install \
64
+ github.com/grpc-ecosystem/grpc-gateway/protoc-gen-swagger@${PROTOC_GEN_SWAGGER_VERSION}
65
+
66
+ WORKDIR /dcl
0 commit comments