blob: 9f54091e65a810f1eb9730bdb3e9b8233e2a2754 [file] [log] [blame]
sjana60af3c92020-04-13 10:53:34 -04001#/*
sjanae1d5c652020-05-08 15:32:58 -04002##==================================================================================
3##
sjanab3dbe862021-02-25 23:17:53 -08004## Copyright (c) 2020-2021 AT&T Intellectual Property.
sjanae1d5c652020-05-08 15:32:58 -04005##
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
sjanab3dbe862021-02-25 23:17:53 -080021ARG STAGE_DIR=/tmp/helloworld-xapp-unittests
sjana60af3c92020-04-13 10:53:34 -040022
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
sjanab3dbe862021-02-25 23:17:53 -080080#Install ASN1C library package hosted at packagecloud.io
81ARG ASN1C_VER=1.0.0
82RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/riclibe2ap_${ASN1C_VER}_amd64.deb/download.deb
83RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/riclibe2ap-dev_${ASN1C_VER}_amd64.deb/download.deb
84RUN dpkg -i riclibe2ap_${ASN1C_VER}_amd64.deb
85RUN dpkg -i riclibe2ap-dev_${ASN1C_VER}_amd64.deb
86
87
88
89
sjana60af3c92020-04-13 10:53:34 -040090## Install SDL Libraries
91WORKDIR ${STAGE_DIR}
92RUN apt-get install -y cpputest
93RUN apt-get remove -y libboost-all-dev
94RUN apt-get install -y libboost-all-dev
95RUN apt-get install -y libhiredis-dev
sjana60af3c92020-04-13 10:53:34 -040096
sjana60af3c92020-04-13 10:53:34 -040097RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/dbaas
98RUN cd dbaas/redismodule && \
99 ./autogen.sh && \
100 ./configure && \
101 make all && \
sjana60af3c92020-04-13 10:53:34 -0400102 make install
103
104WORKDIR ${STAGE_DIR}
105RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl
106RUN cd sdl && \
107 ./autogen.sh && \
108 ./configure && \
109 make all && \
sjana60af3c92020-04-13 10:53:34 -0400110 make install
111
sjana60af3c92020-04-13 10:53:34 -0400112
113WORKDIR ${STAGE_DIR}
114## Install rapidjson
sjana60af3c92020-04-13 10:53:34 -0400115
116RUN git clone https://github.com/Tencent/rapidjson && \
117 cd rapidjson && \
118 mkdir build && \
119 cd build && \
120 cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
121 make install && \
122 cd ${STAGE_DIR} && \
123 rm -rf rapidjson
124
sjana60af3c92020-04-13 10:53:34 -0400125##-----------------------------------
126# Now install the program
127#------------------------------------
128COPY ./ ${STAGE_DIR}
129RUN ls -al
sjana60af3c92020-04-13 10:53:34 -0400130
131RUN export CPATH=$CPATH:/usr/local/include && \
132 cd test && \
133 make clean && \
134 make install
135
136COPY ${SCHEMA_PATH}/* /etc/xapp/
137COPY init/init_script.py /etc/xapp/init_script.py
sjanae1d5c652020-05-08 15:32:58 -0400138COPY init/routes.txt /etc/xapp/routes.txt
sjana60af3c92020-04-13 10:53:34 -0400139
140#---------------------------------------------
141# #Build the final version
sjana60af3c92020-04-13 10:53:34 -0400142
sjanae1d5c652020-05-08 15:32:58 -0400143FROM ubuntu:18.04
sjana60af3c92020-04-13 10:53:34 -0400144
145ARG SCHEMA_PATH
146ARG STAGE_DIR
147
148## copy just the needed libraries install it into the final image
149COPY --from=ricbuild ${STAGE_DIR}/*.deb /tmp/
sjana60af3c92020-04-13 10:53:34 -0400150COPY --from=ricbuild /usr/local/lib/librmr_si* /usr/local/lib/
151COPY --from=ricbuild /usr/local/lib/libgtest* /usr/local/lib/
152COPY --from=ricbuild /usr/local/lib/libsdl* /usr/local/lib/
sjanab3dbe862021-02-25 23:17:53 -0800153COPY --from=ricbuild /usr/local/include/riclibe2ap /usr/local/include/
sjana60af3c92020-04-13 10:53:34 -0400154COPY --from=ricbuild /usr/local/libexec/redismodule/libredis* /usr/local/libexec/redismodule/
155RUN dpkg -i /tmp/*.deb
156RUN apt-get update && \
157 apt-get install -y libcurl3 python3 && \
158 apt-get install -y libboost-all-dev cpputest libhiredis-dev valgrind && \
159 apt-get clean
160COPY --from=ricbuild /etc/xapp/* /etc/xapp/
161COPY --from=ricbuild /usr/local/bin/hw_unit_tests /usr/local/bin/hw_unit_tests
sjanae1d5c652020-05-08 15:32:58 -0400162COPY --from=ricbuild /usr/local/include/rnib/*.h /usr/local/include/rnib/
163COPY --from=ricbuild /usr/local/include/rnib/rnibreader.a /usr/local/include/rnib/
sjana60af3c92020-04-13 10:53:34 -0400164
165
166RUN ldconfig
167
168
169##ENV PYTHONHOME=/opt/python3 \
170## PYTHONPATH=/opt/python3 \
171ENV RMR_RTG_SVC="9999" \
sjanae1d5c652020-05-08 15:32:58 -0400172 RMR_SEED_RT="/etc/xapp/routes.txt" \
sjana60af3c92020-04-13 10:53:34 -0400173 LD_LIBRARY_PATH="/usr/local/lib:/usr/local/libexec" \
sjana60af3c92020-04-13 10:53:34 -0400174 CONFIG_FILE=/opt/ric/config/config-file.json \
175 EXE_FILE=/usr/local/bin/hw_unit_tests
176
177
178CMD python3 /etc/xapp/init_script.py $CONFIG_FILE $EXE_FILE