-
Notifications
You must be signed in to change notification settings - Fork 1
/
Dockerfile.grpc_with_eventlet
67 lines (57 loc) · 2.57 KB
/
Dockerfile.grpc_with_eventlet
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
FROM centos:8
# FROM ubuntu:latest
# Install build tools
RUN yum install -y python3-pip gcc-c++ git python3-devel openssl-devel
# RUN apt update && apt install -y build-essential python3-pip git
# Need to upgrade pip and setuptools
RUN pip3 install --upgrade pip setuptools
# Try building new GCC version, gcc-c++ fails?
#ENV GCC_VERSION=10.3.0
#RUN dnf update -y && \
# dnf -y group install "Development Tools" && \
# yum config-manager --set-enabled powertools && \
# dnf -y install libmpc-devel && \
# curl -O http://gnu.mirror.constant.com/gcc/gcc-$GCC_VERSION/gcc-$GCC_VERSION.tar.gz && \
# tar zxf gcc-$GCC_VERSION.tar.gz && \
# mkdir gcc-build && cd gcc-build && \
# ../gcc-$GCC_VERSION/configure --enable-languages=c,c++ --disable-multilib && \
# make -j$(nproc) && make install && \
# ln -sf /usr/local/bin/gcc /usr/bin/gcc-10 && \
# ln -sf /usr/local/bin/g++ /usr/bin/g++-10
# RUN yum install -y gcc-toolset-10-gcc-c++
# Install Bazel build tool, needs /usr/bin/python
RUN cd /etc/yum.repos.d/ && \
curl -O https://copr.fedorainfracloud.org/coprs/vbatts/bazel/repo/epel-7/vbatts-bazel-epel-7.repo && \
yum install -y bazel4 && \
alternatives --set python /usr/bin/python3
# Build gRPC with eventlet support
# TODO use separate build image and copy only resulting binaries
# Follow these instructions: https://github.com/grpc/grpc/tree/master/src/python/grpcio
# removed: sudo pip3 install -r requirements.bazel.txt && \
# Try: python3 -m pip install --compiler=/usr/local/bin/gcc .
RUN cd /tmp && \
git clone https://github.com/jbemmel/grpc.git && \
cd grpc && \
git submodule update --init && \
pip3 install -r requirements.txt
# Split for now
COPY ./src /opt/srlinux/agents/
# RUN cd /tmp/grpc && GRPC_PYTHON_BUILD_WITH_CYTHON=1 CC=/usr/bin/gcc CXX=/usr/bin/g++ python3 -m pip install .
# RUN cd /tmp/grpc && GRPC_PYTHON_BUILD_WITH_CYTHON=1 python3 -m pip install --no-clean --verbose --log /tmp/pip.log .
# or CC=/usr/bin/gcc bazel build :all
# RUN cd /tmp/grpc && bazel build :python3
# Using cmake
RUN yum install -y cmake make autoconf pkg-config && \
yum upgrade -y libarchive && \
cd /tmp/grpc/ && \
mkdir -p cmake/build && \
pushd cmake/build && \
cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=/usr/local ../.. && \
make -j$(nproc) && \
make install && \
popd && \
mkdir -p third_party/abseil-cpp/cmake/build && \
pushd third_party/abseil-cpp/cmake/build && \
cmake -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_POSITION_INDEPENDENT_CODE=TRUE ../.. && \
make -j$(nproc) && \
make install