blob: 60efaca1e9ce4871321ac135be8d4c688759c120 [file] [log] [blame]
sjana60af3c92020-04-13 10:53:34 -04001#/*
2#==================================================================================
3# Copyright (c) 2018-2019 AT&T Intellectual Property.
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9# http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#==================================================================================
17#*/
18ARG SCHEMA_PATH=schemas
19ARG STAGE_DIR=/tmp/helloworld-xapp
20
21#==================================================================================
22FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu16-c-go@sha256:f4ebcc792b501f283c7848018b6f106bbcecf1f9e699035950614460b3c330f8 as ricbuild
23
24# to override repo base, pass in repo argument when running docker build:
25# docker build --build-arg REPOBASE=http://abc.def.org . ....
26ARG REPOBASE=https://gerrit.oran-osc.org/r
27ARG SCHEMA_FILE
28ARG SCHEMA_PATH
29ARG STAGE_DIR
30
31# Install necessary packages
32WORKDIR ${STAGE_DIR}
33RUN apt-get update \
34 && apt-get install -y \
35 libcurl4-openssl-dev \
36 libcurl3 \
37 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
53RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/mdclog_${MDC_VER}_amd64.deb/download.deb
54RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/mdclog-dev_${MDC_VER}_amd64.deb/download.deb
55RUN 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
59ARG RMR_VER=3.6.2
60RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_${RMR_VER}_amd64.deb/download.deb
61RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_${RMR_VER}_amd64.deb/download.deb
62RUN 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}
68RUN apt-get install libgtest-dev
69RUN cd /usr/src/gtest \
70 && cmake CMakeLists.txt \
71 && make \
72 && cp *.a /usr/local/lib
73
74
75## Install SDL Libraries
76WORKDIR ${STAGE_DIR}
77RUN apt-get install -y cpputest
78RUN apt-get remove -y libboost-all-dev
79RUN apt-get install -y libboost-all-dev
80RUN apt-get install -y libhiredis-dev
81RUN apt-get install -y valgrind
82
83RUN git config --global http.proxy http://one.proxy.att.com:8080
84RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/dbaas
85RUN cd dbaas/redismodule && \
86 ./autogen.sh && \
87 ./configure && \
88 make all && \
89## make test && \
90 make install
91
92WORKDIR ${STAGE_DIR}
93RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl
94RUN cd sdl && \
95 ./autogen.sh && \
96 ./configure && \
97 make all && \
98# make test && \
99 make install
100
101RUN git config --global --unset http.proxy
102
103WORKDIR ${STAGE_DIR}
104## Install rapidjson
105 #git checkout tags/v1.1.0 && \
106
107RUN git clone https://github.com/Tencent/rapidjson && \
108 cd rapidjson && \
109 mkdir build && \
110 cd build && \
111 cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
112 make install && \
113 cd ${STAGE_DIR} && \
114 rm -rf rapidjson
115
116### Copy RNIB library and include rnib.
117RUN mkdir /usr/local/include/rnib
118
119##-----------------------------------
120# Now install the program
121#------------------------------------
122COPY ./ ${STAGE_DIR}
123RUN ls -al
124COPY ${STAGE}/rnib/*.h /usr/local/include/rnib/
125COPY ${STAGE}/rnibreader_old.a /usr/local/lib/
126
127RUN export CPATH=$CPATH:/usr/local/include && \
128 cd test && \
129 make clean && \
130 make install
131
132COPY ${SCHEMA_PATH}/* /etc/xapp/
133COPY init/init_script.py /etc/xapp/init_script.py
134
135
136#---------------------------------------------
137# #Build the final version
138##FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu16-c-go:1-u16.04-nng1.1.1
139
140FROM ubuntu:16.04
141
142ARG SCHEMA_PATH
143ARG STAGE_DIR
144
145## copy just the needed libraries install it into the final image
146COPY --from=ricbuild ${STAGE_DIR}/*.deb /tmp/
147#COPY --from=ricbuild /usr/local/libexec/. /usr/local/libexec/.
148COPY --from=ricbuild /usr/local/lib/librmr_si* /usr/local/lib/
149COPY --from=ricbuild /usr/local/lib/libgtest* /usr/local/lib/
150COPY --from=ricbuild /usr/local/lib/libsdl* /usr/local/lib/
151COPY --from=ricbuild /usr/local/libexec/redismodule/libredis* /usr/local/libexec/redismodule/
152RUN dpkg -i /tmp/*.deb
153RUN apt-get update && \
154 apt-get install -y libcurl3 python3 && \
155 apt-get install -y libboost-all-dev cpputest libhiredis-dev valgrind && \
156 apt-get clean
157COPY --from=ricbuild /etc/xapp/* /etc/xapp/
158COPY --from=ricbuild /usr/local/bin/hw_unit_tests /usr/local/bin/hw_unit_tests
159COPY --from=ricbuild ${STAGE_DIR}/rnib/*.h /usr/local/include/rnib/
160COPY --from=ricbuild ${STAGE_DIR}/rnibreader_old.a /usr/local/lib/
161
162##COPY --from=ricbuild /usr/local/bin/e2e-test-client /usr/local/bin/e2e-test-client
163##COPY --from=ricbuild /usr/local/bin/mock-e2term-server /usr/local/bin/mock-e2term-server
164##COPY --from=ricbuild /usr/local/bin/e2e-perf-client /usr/local/bin/e2e-perf-client
165##COPY --from=ricbuild /usr/local/bin/e2e-perf-server /usr/local/bin/e2e-perf-server
166##COPY --from=ricbuild /usr/local/bin/mock-a1-server /usr/local/bin/mock-a1-server
167
168
169RUN ldconfig
170
171
172##ENV PYTHONHOME=/opt/python3 \
173## PYTHONPATH=/opt/python3 \
174ENV RMR_RTG_SVC="9999" \
175 LD_LIBRARY_PATH="/usr/local/lib:/usr/local/libexec" \
176 NAME=ADM_CTRL_XAPP \
177 PORT=tcp:4560 \
178 THREADS=1\
179 VERBOSE=0 \
180 MESSAGE_TYPE=10002 \
181 RATE=1 \
182 CONFIG_FILE=/opt/ric/config/config-file.json \
183 EXE_FILE=/usr/local/bin/hw_unit_tests
184
185
186CMD python3 /etc/xapp/init_script.py $CONFIG_FILE $EXE_FILE