-
Notifications
You must be signed in to change notification settings - Fork 11
/
Dockerfile.dapper
69 lines (57 loc) · 2.26 KB
/
Dockerfile.dapper
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 registry.suse.com/bci/golang:1.23
ARG DAPPER_HOST_ARCH=amd64
ARG http_proxy
ARG https_proxy
ENV HOST_ARCH=${DAPPER_HOST_ARCH} ARCH=${DAPPER_HOST_ARCH}
ENV PROTOC_VER=24.3
ENV PROTOBUF_VER_PY=4.24.3
ENV PROTOC_GEN_GO_VER=v1.31.0
ENV PROTOC_GEN_GO_GRPC_VER=v1.3.0
# Setup environment
ENV PATH /go/bin:$PATH
ENV DAPPER_DOCKER_SOCKET true
ENV DAPPER_SOURCE /go/src/github.com/longhorn/types
ENV DAPPER_OUTPUT ./pkg ./generated-py
WORKDIR ${DAPPER_SOURCE}
RUN zypper -n addrepo --refresh https://download.opensuse.org/repositories/system:/snappy/SLE_15/system:snappy.repo && \
zypper --gpg-auto-import-keys ref
# TODO: replace python311 with python3 if SLE upgrade system python version to python3.10+
RUN zypper -n install wget git unzip python311 python311-devel python311-pip && \
rm -rf rm -rf /var/cache/zypp/*
# needed for ${!var} substitution
RUN rm -f /bin/sh && ln -s /bin/bash /bin/sh
# protoc
ENV PROTOC_amd64=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-linux-x86_64.zip \
PROTOC_arm64=https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VER}/protoc-${PROTOC_VER}-linux-aarch_64.zip \
PROTOC=PROTOC_${ARCH}
RUN cd /usr/src && \
wget ${!PROTOC} -O protoc_${ARCH}.zip && \
unzip protoc_${ARCH}.zip -d /usr/local/
# protoc-gen-go
RUN mkdir -p /go/src/github.com && \
cd /go/src/github.com/ && \
mkdir protocolbuffers/ && \
cd protocolbuffers && \
git clone https://github.com/protocolbuffers/protobuf-go.git && \
cd protobuf-go && \
git checkout ${PROTOC_GEN_GO_VER} && \
cd cmd/protoc-gen-go && \
go build && \
cp protoc-gen-go /usr/local/bin
# protoc-gen-go-grpc
RUN cd /go/src/github.com/ && \
mkdir grpc/ && \
cd grpc && \
git clone https://github.com/grpc/grpc-go.git && \
cd grpc-go && \
git checkout cmd/protoc-gen-go-grpc/${PROTOC_GEN_GO_GRPC_VER} && \
cd cmd/protoc-gen-go-grpc && \
go build && \
cp protoc-gen-go-grpc /usr/local/bin
# use python 3.11, so we can install latest grpcio
RUN ln -sf /usr/bin/python3.11 /usr/bin/python3 & \
ln -sf /usr/bin/pip3.11 /usr/bin/pip3
# python grpc-tools
RUN pip3 install grpcio==1.58.0 grpcio_tools==1.58.0 protobuf==${PROTOBUF_VER_PY}
ENTRYPOINT ["./scripts/entry"]
CMD ["ci"]