blob: b14d62d9c3cfb0c61542af4ac2635419fb70497c [file] [log] [blame]
sjana60af3c92020-04-13 10:53:34 -04001#/*
sjanae1d5c652020-05-08 15:32:58 -04002##==================================================================================
3##
4## Copyright (c) 2019-2020 AT&T Intellectual Property.
5##
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
9##
10## http://www.apache.org/licenses/LICENSE-2.0
11##
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##==================================================================================
18## */
19
sjana60af3c92020-04-13 10:53:34 -040020ARG SCHEMA_PATH=schemas
21ARG STAGE_DIR=/tmp/helloworld-xapp
22
23#==================================================================================
sjanae1d5c652020-05-08 15:32:58 -040024FROM nexus3.o-ran-sc.org:10001/ubuntu:18.04 as ricbuild
sjana60af3c92020-04-13 10:53:34 -040025
26# to override repo base, pass in repo argument when running docker build:
27# docker build --build-arg REPOBASE=http://abc.def.org . ....
28ARG REPOBASE=https://gerrit.oran-osc.org/r
29ARG SCHEMA_FILE
30ARG SCHEMA_PATH
31ARG STAGE_DIR
32
33# Install necessary packages
34WORKDIR ${STAGE_DIR}
35RUN apt-get update \
36 && apt-get install -y \
sjana60af3c92020-04-13 10:53:34 -040037 cmake \
38 git \
39 build-essential \
40 automake \
41 autoconf-archive \
42 autoconf \
43 pkg-config \
44 gawk \
45 libtool \
46 wget \
47 zlib1g-dev \
48 libffi-dev \
49 && apt-get clean
50
51# Install mdclog using debian package hosted at packagecloud.io
52ARG MDC_VER=0.0.4-1
sjanae1d5c652020-05-08 15:32:58 -040053RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/mdclog_${MDC_VER}_amd64.deb/download.deb
54RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/mdclog-dev_${MDC_VER}_amd64.deb/download.deb
sjana60af3c92020-04-13 10:53:34 -040055RUN dpkg -i mdclog_${MDC_VER}_amd64.deb
56RUN dpkg -i mdclog-dev_${MDC_VER}_amd64.deb
57
58# Install RMr using debian package hosted at packagecloud.io
sjana45fd3672020-12-10 13:42:50 -050059ARG RMR_VER=4.4.6
sjanae1d5c652020-05-08 15:32:58 -040060RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr_${RMR_VER}_amd64.deb/download.deb
61RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rmr-dev_${RMR_VER}_amd64.deb/download.deb
sjana60af3c92020-04-13 10:53:34 -040062RUN dpkg -i rmr_${RMR_VER}_amd64.deb
63RUN dpkg -i rmr-dev_${RMR_VER}_amd64.deb
64
65##Iinstall Google test
66
67WORKDIR ${STAGE_DIR}
sjanae1d5c652020-05-08 15:32:58 -040068RUN apt-get install -y libgtest-dev
sjana60af3c92020-04-13 10:53:34 -040069RUN cd /usr/src/gtest \
70 && cmake CMakeLists.txt \
71 && make \
72 && cp *.a /usr/local/lib
73
sjanae1d5c652020-05-08 15:32:58 -040074#Install RNIB libraries
75ARG RNIB_VER=1.0.0
76RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rnib_${RNIB_VER}_all.deb/download.deb
77RUN dpkg -i rnib_${RNIB_VER}_all.deb
78
sjana60af3c92020-04-13 10:53:34 -040079
80## Install SDL Libraries
81WORKDIR ${STAGE_DIR}
82RUN apt-get install -y cpputest
83RUN apt-get remove -y libboost-all-dev
84RUN apt-get install -y libboost-all-dev
85RUN apt-get install -y libhiredis-dev
sjana60af3c92020-04-13 10:53:34 -040086
sjana60af3c92020-04-13 10:53:34 -040087RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/dbaas
88RUN cd dbaas/redismodule && \
89 ./autogen.sh && \
90 ./configure && \
91 make all && \
sjana60af3c92020-04-13 10:53:34 -040092 make install
93
94WORKDIR ${STAGE_DIR}
95RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl
96RUN cd sdl && \
97 ./autogen.sh && \
98 ./configure && \
99 make all && \
sjana60af3c92020-04-13 10:53:34 -0400100 make install
101
sjana60af3c92020-04-13 10:53:34 -0400102
103WORKDIR ${STAGE_DIR}
104## Install rapidjson
sjana60af3c92020-04-13 10:53:34 -0400105
106RUN git clone https://github.com/Tencent/rapidjson && \
107 cd rapidjson && \
108 mkdir build && \
109 cd build && \
110 cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
111 make install && \
112 cd ${STAGE_DIR} && \
113 rm -rf rapidjson
114
sjana60af3c92020-04-13 10:53:34 -0400115##-----------------------------------
116# Now install the program
117#------------------------------------
118COPY ./ ${STAGE_DIR}
119RUN ls -al
sjana60af3c92020-04-13 10:53:34 -0400120
121RUN export CPATH=$CPATH:/usr/local/include && \
122 cd test && \
123 make clean && \
124 make install
125
126COPY ${SCHEMA_PATH}/* /etc/xapp/
127COPY init/init_script.py /etc/xapp/init_script.py
sjanae1d5c652020-05-08 15:32:58 -0400128COPY init/routes.txt /etc/xapp/routes.txt
sjana60af3c92020-04-13 10:53:34 -0400129
130#---------------------------------------------
131# #Build the final version
sjana60af3c92020-04-13 10:53:34 -0400132
sjanae1d5c652020-05-08 15:32:58 -0400133FROM ubuntu:18.04
sjana60af3c92020-04-13 10:53:34 -0400134
135ARG SCHEMA_PATH
136ARG STAGE_DIR
137
138## copy just the needed libraries install it into the final image
139COPY --from=ricbuild ${STAGE_DIR}/*.deb /tmp/
sjana60af3c92020-04-13 10:53:34 -0400140COPY --from=ricbuild /usr/local/lib/librmr_si* /usr/local/lib/
141COPY --from=ricbuild /usr/local/lib/libgtest* /usr/local/lib/
142COPY --from=ricbuild /usr/local/lib/libsdl* /usr/local/lib/
143COPY --from=ricbuild /usr/local/libexec/redismodule/libredis* /usr/local/libexec/redismodule/
144RUN dpkg -i /tmp/*.deb
145RUN apt-get update && \
146 apt-get install -y libcurl3 python3 && \
147 apt-get install -y libboost-all-dev cpputest libhiredis-dev valgrind && \
148 apt-get clean
149COPY --from=ricbuild /etc/xapp/* /etc/xapp/
150COPY --from=ricbuild /usr/local/bin/hw_unit_tests /usr/local/bin/hw_unit_tests
sjanae1d5c652020-05-08 15:32:58 -0400151COPY --from=ricbuild /usr/local/include/rnib/*.h /usr/local/include/rnib/
152COPY --from=ricbuild /usr/local/include/rnib/rnibreader.a /usr/local/include/rnib/
sjana60af3c92020-04-13 10:53:34 -0400153
154
155RUN ldconfig
156
157
158##ENV PYTHONHOME=/opt/python3 \
159## PYTHONPATH=/opt/python3 \
160ENV RMR_RTG_SVC="9999" \
sjanae1d5c652020-05-08 15:32:58 -0400161 RMR_SEED_RT="/etc/xapp/routes.txt" \
sjana60af3c92020-04-13 10:53:34 -0400162 LD_LIBRARY_PATH="/usr/local/lib:/usr/local/libexec" \
sjana60af3c92020-04-13 10:53:34 -0400163 CONFIG_FILE=/opt/ric/config/config-file.json \
164 EXE_FILE=/usr/local/bin/hw_unit_tests
165
166
167CMD python3 /etc/xapp/init_script.py $CONFIG_FILE $EXE_FILE