2 #==================================================================================
4 # Copyright (c) 2019-2020 AT&T Intellectual Property.
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
10 # http://www.apache.org/licenses/LICENSE-2.0
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #==================================================================================
20 ARG SCHEMA_PATH=schemas
21 ARG STAGE_DIR=/tmp/bouncer-xapp
23 #==================================================================================
24 FROM nexus3.o-ran-sc.org:10001/ubuntu:18.04 as ricbuild
26 # to override repo base, pass in repo argument when running docker build:
27 # docker build --build-arg REPOBASE=http://abc.def.org . ....
28 ARG REPOBASE=https://gerrit.oran-osc.org/r
33 # Install necessary packages
36 && apt-get install -y \
51 # Install mdclog using debian package hosted at packagecloud.io
53 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/mdclog_${MDC_VER}_amd64.deb/download.deb
54 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/mdclog-dev_${MDC_VER}_amd64.deb/download.deb
55 RUN dpkg -i mdclog_${MDC_VER}_amd64.deb
56 RUN dpkg -i mdclog-dev_${MDC_VER}_amd64.deb
58 # Install RMr using debian package hosted at packagecloud.io
60 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMR_VER}_amd64.deb/download.deb
61 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMR_VER}_amd64.deb/download.deb
62 RUN dpkg -i rmr_${RMR_VER}_amd64.deb
63 RUN dpkg -i rmr-dev_${RMR_VER}_amd64.deb
65 #Install RNIB libraries
67 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rnib_${RNIB_VER}_all.deb/download.deb
68 RUN dpkg -i rnib_${RNIB_VER}_all.deb
70 ## Install SDL Libraries
72 RUN apt-get install -y cpputest
73 RUN apt-get remove -y libboost-all-dev
74 RUN apt-get install -y libboost-all-dev
75 RUN apt-get install -y libhiredis-dev
76 #RUN apt-get install -y valgrind
78 RUN mkdir /usr/local/include/nlohmann
79 RUN git clone https://github.com/azadkuh/nlohmann_json_release.git
80 RUN cp nlohmann_json_release/json.hpp /usr/local/include/nlohmann
82 RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/dbaas
83 RUN cd dbaas/redismodule && \
90 RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl
101 RUN git clone https://github.com/Tencent/rapidjson && \
105 cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
111 ## Install CPPRESTSDK
113 RUN apt-get install -y libcpprest-dev
114 RUN apt-get install -y g++ git libboost-atomic-dev libboost-thread-dev libboost-system-dev libboost-date-time-dev libboost-regex-dev libboost-filesystem-dev libboost-random-dev libboost-chrono-dev libboost-serialization-dev libwebsocketpp-dev openssl libssl-dev ninja-build zlib1g-dev
115 RUN git clone https://github.com/Microsoft/cpprestsdk.git casablanca && \
119 cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
124 ##-----------------------------------
125 # Now install the program
126 #------------------------------------
131 RUN export CPATH=$CPATH:/usr/local/include && \
133 # source ./xapp_env.sh \
137 COPY ${SCHEMA_PATH}/* /etc/xapp/
138 COPY init/init_script.py /etc/xapp/init_script.py
139 COPY init/routes.txt /etc/xapp/routes.txt
140 #---------------------------------------------
141 # #Build the final version
148 ## copy just the needed libraries install it into the final image
149 COPY --from=ricbuild ${STAGE_DIR}/*.deb /tmp/
150 COPY --from=ricbuild /usr/local/lib/librmr_si* /usr/local/lib/
151 COPY --from=ricbuild /usr/local/lib/libsdl* /usr/local/lib/
152 COPY --from=ricbuild /usr/local/libexec/redismodule/libredis* /usr/local/libexec/redismodule/
153 RUN dpkg -i /tmp/*.deb
154 RUN apt-get update && \
155 apt-get install -y libcurl3 python3 && \
156 apt-get install -y libboost-all-dev cpputest libcpprest-dev libhiredis-dev valgrind && \
158 COPY --from=ricbuild /etc/xapp/* /etc/xapp/
159 COPY --from=ricbuild /usr/local/bin/b_xapp_main /usr/local/bin/b_xapp_main
160 COPY --from=ricbuild /usr/local/lib/libcpprest.so* /usr/local/bin/
161 COPY --from=ricbuild /usr/local/lib/libcpprest.so* /usr/local/lib/
162 COPY --from=ricbuild /usr/local/include/rnib/*.h /usr/local/include/rnib/
163 COPY --from=ricbuild /usr/local/include/rnib/rnibreader.a /usr/local/include/rnib/
167 RUN sysctl -w net.ipv6.conf.lo.disable_ipv6=1
169 ##ENV PYTHONHOME=/opt/python3 \
170 ## PYTHONPATH=/opt/python3 \
171 ENV RMR_RTG_SVC="9999" \
172 RMR_SEED_RT="/etc/xapp/routes.txt" \
173 LD_LIBRARY_PATH="/usr/local/lib:/usr/local/libexec" \
175 CONFIG_FILE=/opt/ric/config/config-file.json
179 CMD python3 /etc/xapp/init_script.py $CONFIG_FILE