forked from Cisco-Service-Layer/service-layer-objmodel
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDockerfile
More file actions
76 lines (57 loc) · 2.37 KB
/
Copy pathDockerfile
File metadata and controls
76 lines (57 loc) · 2.37 KB
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
70
71
72
73
74
75
76
FROM ubuntu:bionic
RUN apt-get update && \
apt-get install -y git vim doxygen autoconf automake libtool \
build-essential pkg-config curl make \
unzip python3 python3-pip python3-venv wget libssl-dev
# python
RUN python3 -m venv /opt/venv
RUN . /opt/venv/bin/activate
COPY grpc/python/requirements.txt /tmp
RUN pip3 install -r /tmp/requirements.txt
ARG GO_VER=1.19
ARG WS=/ws
RUN mkdir -p ${WS}
WORKDIR ${WS}
# Install GO binary https://go.dev/doc/install
RUN wget -qO- https://golang.org/dl/go${GO_VER}.linux-amd64.tar.gz | tar xzvf - -C /usr/local
#Ensure PATH has GO binary path
ENV PATH="${PATH}:/usr/local/go/bin"
# Install protocol buffer compiler https://grpc.io/docs/protoc-installation/
ARG PB_REL=https://github.com/protocolbuffers/protobuf/releases
RUN curl -LO ${PB_REL}/download/v3.18.1/protoc-3.18.1-linux-x86_64.zip
RUN unzip protoc-3.18.1-linux-x86_64.zip -d /usr/local
# Install protoc-gen-go and protoc-gen-go-grpc
# Reference https://grpc.io/docs/languages/go/quickstart
RUN go install google.golang.org/protobuf/cmd/protoc-gen-go@v1.28
RUN go install google.golang.org/grpc/cmd/protoc-gen-go-grpc@v1.2
# Above were installed in $HOME/go, since this is running as root
ENV PATH="${PATH}:/root/go/bin"
####################
# CPP grpc build and install
# reference https://grpc.io/docs/languages/cpp/quickstart
ARG MY_INSTALL_DIR=/root/.local
RUN mkdir -p ${MY_INSTALL_DIR}
ENV PATH="${PATH}:${MY_INSTALL_DIR}/bin"
#get cmake
RUN wget -q -O cmake-linux.sh https://github.com/Kitware/CMake/releases/download/v3.19.6/cmake-3.19.6-Linux-x86_64.sh
RUN sh cmake-linux.sh -- --skip-license --prefix=${MY_INSTALL_DIR}
# Clone GRPC repo
RUN git clone --recurse-submodules -b v1.46.3 --depth 1 --shallow-submodules https://github.com/grpc/grpc
WORKDIR ${WS}/grpc
RUN mkdir -p cmake/build
WORKDIR ${WS}/grpc/cmake/build
RUN cmake -DgRPC_INSTALL=ON -DgRPC_BUILD_TESTS=OFF -DCMAKE_INSTALL_PREFIX=${MY_INSTALL_DIR} ../..
RUN make -j
RUN make install
WORKDIR ${WS}
############
# Clone glog repo. this is required for the CPP rshuttle application.
RUN git clone https://github.com/google/glog.git glog
WORKDIR ${WS}/glog
# Configure build tree
RUN cmake -S . -B build -G "Unix Makefiles"
RUN cmake --build build
RUN cmake --build build --target install
###########
# Adjust PATH so that binding scripts can execute out of the cwd.
ENV PATH="${PATH}:."