-
Notifications
You must be signed in to change notification settings - Fork 15
/
Dockerfile_oai_xapp
154 lines (143 loc) · 5.19 KB
/
Dockerfile_oai_xapp
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
##-----------------------------------
# BS Connector
#------------------------------------
ARG SCHEMA_PATH=schemas
ARG XAPP_DIR=sample-xapp
ARG CONNECTOR_DIR=xapp-sm-connector
ARG STAGE_DIR=/home/${CONNECTOR_DIR}
ARG DBAAS_SERVICE_HOST=10.0.2.12
ARG DBAAS_SERVICE_PORT="6379"
#==================================================================================
FROM ubuntu:18.04 as ricbuild
# to override repo base, pass in repo argument when running docker build:
# docker build --build-arg REPOBASE=http://abc.def.org . ....
ARG REPOBASE=https://gerrit.oran-osc.org/r
ARG SCHEMA_FILE
ARG SCHEMA_PATH
ARG XAPP_DIR
ARG CONNECTOR_DIR
ARG STAGE_DIR
ARG MDC_VER=0.0.4-1
ARG RMR_VER=4.0.5
ARG RNIB_VER=1.0.0
ENV RMR_RTG_SVC="9999" \
RMR_SEED_RT="/home/${CONNECTOR_DIR}/init/routes.txt" \
LD_LIBRARY_PATH="/usr/local/lib:/usr/local/libexec" \
VERBOSE=0 \
CONFIG_FILE=/opt/ric/config/config-file.json \
DBAAS_SERVICE_HOST=${DBAAS_SERVICE_HOST} \
DBAAS_SERVICE_PORT=${DBAAS_SERVICE_PORT}
COPY ${CONNECTOR_DIR} ${STAGE_DIR}
COPY ${XAPP_DIR} /home/${XAPP_DIR}
WORKDIR ${STAGE_DIR}
# Install necessary packages
RUN apt-get update \
&& apt-get install -y \
cmake \
git \
build-essential \
automake \
autoconf-archive \
autoconf \
pkg-config \
gawk \
libtool \
wget \
zlib1g-dev \
libffi-dev \
libcurl4-openssl-dev \
vim \
cpputest \
libboost-all-dev \
libhiredis-dev \
&& apt-get remove -y --purge python* \
&& apt-get install -y \
#python3 \ we will install python 3.8 which is required for protobuf
python3-pip \
# Install mdclog using debian package hosted at packagecloud.io
&& wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/mdclog_${MDC_VER}_amd64.deb/download.deb \
&& wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/mdclog-dev_${MDC_VER}_amd64.deb/download.deb \
&& dpkg -i mdclog_${MDC_VER}_amd64.deb \
&& dpkg -i mdclog-dev_${MDC_VER}_amd64.deb \
&& rm mdclog_${MDC_VER}_amd64.deb mdclog-dev_${MDC_VER}_amd64.deb \
# Install RMR using debian package hosted at packagecloud.io
&& wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMR_VER}_amd64.deb/download.deb \
&& wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMR_VER}_amd64.deb/download.deb \
&& dpkg -i rmr_${RMR_VER}_amd64.deb \
&& dpkg -i rmr-dev_${RMR_VER}_amd64.deb \
&& rm rmr_${RMR_VER}_amd64.deb rmr-dev_${RMR_VER}_amd64.deb \
# Install RNIB libraries
&& wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rnib_${RNIB_VER}_all.deb/download.deb \
&& dpkg -i rnib_${RNIB_VER}_all.deb \
&& rm rnib_${RNIB_VER}_all.deb \
# Install dbaas
&& cd ${STAGE_DIR} \
&& git clone https://gerrit.o-ran-sc.org/r/ric-plt/dbaas \
&& cd dbaas/redismodule \
&& ./autogen.sh \
&& ./configure \
&& make -j ${nproc} all \
&& make install \
&& rm -Rf ${STAGE_DIR}/dbaas \
# Install sdl
&& cd ${STAGE_DIR} \
&& git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl \
&& cd sdl \
&& ./autogen.sh \
&& ./configure \
&& make -j ${nproc} all \
&& make install \
&& rm -Rf ${STAGE_DIR}/sdl \
# Install rapidjson
&& cd ${STAGE_DIR} \
&& git clone https://github.com/Tencent/rapidjson \
&& cd rapidjson \
&& mkdir build \
&& cd build \
&& cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. \
&& make -j ${nproc} \
&& make install \
&& cd ${STAGE_DIR} \
&& rm -rf rapidjson \
##-----------------------------------
# Now install the program
#------------------------------------
# build connector
&& export CPATH=$CPATH:/usr/local/include \
&& cd src \
&& make clean \
&& make -j ${nproc} \
&& make install \
&& ldconfig \
&& sysctl -w net.ipv6.conf.lo.disable_ipv6=1 \
###-----------------------------------
## DRL Agent
##------------------------------------
## install packages and pip requirements
# && pip3 --no-cache-dir install -U pip \
# && pip3 --no-cache-dir install -r /home/${XAPP_DIR}/requirements.txt \
&& apt-get autoremove -y \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# install protobuf c
RUN wget https://github.com/protocolbuffers/protobuf/releases/download/v21.7/protobuf-python-4.21.7.tar.gz \
&& mkdir pbuf && mv protobuf-python-4.21.7.tar.gz pbuf && cd pbuf \
&& tar -xzf protobuf-python-4.21.7.tar.gz \
&& cd protobuf-4.21.7/ \
&& ./configure \
&& make -j`nproc` \
&& make install
# install python3.8 and protobuf-python
RUN apt update && apt install software-properties-common \
&& add-apt-repository ppa:deadsnakes/ppa \
&& apt install python3.8 \
&& update-alternatives --install /usr/bin/python3 python3 /usr/bin/python3.8 1 \
&& update-alternatives --install /usr/bin/python python /usr/bin/python3.8 1 \
&& pip3 install protobuf
# ssh server
RUN mkdir /var/run/sshd \
&& echo 'root:mypassword' | chpasswd \
&& sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/' /etc/ssh/sshd_config \
&& sed 's@session\s*required\s*pam_loginuid.so@session optional pam_loginuid.so@g' -i /etc/pam.d/sshd
EXPOSE 22
CMD ["/usr/sbin/sshd", "-D"]