HelloWorld E2SM unit tests
[ric-app/hw.git] / Dockerfile
1 #/*
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 #*/
18 ARG SCHEMA_PATH=schemas
19 ARG STAGE_DIR=/tmp/helloworld-xapp
20
21 #==================================================================================
22 FROM 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 . ....
26 ARG REPOBASE=https://gerrit.oran-osc.org/r
27 ARG SCHEMA_FILE
28 ARG SCHEMA_PATH
29 ARG STAGE_DIR
30
31 # Install necessary packages
32 WORKDIR ${STAGE_DIR}
33 RUN 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
52 ARG MDC_VER=0.0.4-1
53 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/mdclog_${MDC_VER}_amd64.deb/download.deb
54 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/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
57
58 # Install RMr using debian package hosted at packagecloud.io
59 ARG RMR_VER=3.6.5
60 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_${RMR_VER}_amd64.deb/download.deb
61 RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/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
64
65 ## Install SDL Libraries
66 WORKDIR ${STAGE_DIR}
67 RUN apt-get install -y cpputest
68 RUN apt-get remove -y libboost-all-dev
69 RUN apt-get install -y  libboost-all-dev
70 RUN apt-get install -y libhiredis-dev
71 RUN apt-get install -y valgrind
72
73 RUN git config --global http.proxy http://one.proxy.att.com:8080
74 RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/dbaas
75 RUN cd dbaas/redismodule && \
76     ./autogen.sh && \
77     ./configure && \
78     make all && \
79 #    make test && \
80     make install
81
82 WORKDIR ${STAGE_DIR}
83 RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl
84 RUN cd sdl && \
85     ./autogen.sh && \
86     ./configure && \
87     make all && \
88 #    make test && \
89     make install
90
91 RUN git config --global --unset http.proxy
92
93 WORKDIR ${STAGE_DIR}
94 ## Install rapidjson
95     #git checkout tags/v1.1.0 && \
96
97 RUN git clone https://github.com/Tencent/rapidjson && \
98     cd rapidjson && \
99     mkdir build && \
100     cd build && \
101     cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
102     make install && \
103     cd ${STAGE_DIR} && \
104     rm -rf rapidjson
105
106 ### Copy RNIB library and include rnib.
107 RUN mkdir /usr/local/include/rnib
108
109 ##-----------------------------------
110 # Now install the program
111 #------------------------------------
112 COPY ./ ${STAGE_DIR}
113 RUN ls -al
114 COPY ${STAGE}/rnib/*.h /usr/local/include/rnib/
115 COPY ${STAGE}/rnibreader_old.a /usr/local/lib/
116
117 RUN export CPATH=$CPATH:/usr/local/include && \ 
118     cd src && \
119     make clean && \
120     make install 
121
122 COPY ${SCHEMA_PATH}/* /etc/xapp/ 
123 COPY init/init_script.py /etc/xapp/init_script.py
124
125 #---------------------------------------------
126 # #Build the final version
127
128 FROM ubuntu:16.04
129
130 ARG SCHEMA_PATH
131 ARG STAGE_DIR
132
133 ## copy just the needed libraries install it into the final image
134 COPY --from=ricbuild ${STAGE_DIR}/*.deb /tmp/
135 #COPY --from=ricbuild /usr/local/libexec/. /usr/local/libexec/.
136 COPY --from=ricbuild /usr/local/lib/librmr_si* /usr/local/lib/
137 COPY --from=ricbuild /usr/local/lib/libsdl* /usr/local/lib/
138 COPY --from=ricbuild /usr/local/libexec/redismodule/libredis* /usr/local/libexec/redismodule/
139 RUN dpkg -i /tmp/*.deb
140 RUN apt-get update && \
141     apt-get install -y libcurl3 python3 && \
142     apt-get install -y libboost-all-dev cpputest libhiredis-dev valgrind && \
143     apt-get clean
144 COPY --from=ricbuild /etc/xapp/* /etc/xapp/
145 COPY --from=ricbuild /usr/local/bin/hw_xapp_main /usr/local/bin/hw_xapp_main
146 COPY --from=ricbuild ${STAGE_DIR}/rnib/*.h /usr/local/include/rnib/
147 COPY --from=ricbuild ${STAGE_DIR}/rnibreader_old.a /usr/local/lib/
148
149 ##COPY --from=ricbuild /usr/local/bin/e2e-test-client /usr/local/bin/e2e-test-client
150 ##COPY --from=ricbuild /usr/local/bin/mock-e2term-server /usr/local/bin/mock-e2term-server
151 ##COPY --from=ricbuild /usr/local/bin/e2e-perf-client /usr/local/bin/e2e-perf-client
152 ##COPY --from=ricbuild /usr/local/bin/e2e-perf-server /usr/local/bin/e2e-perf-server
153 ##COPY --from=ricbuild /usr/local/bin/mock-a1-server /usr/local/bin/mock-a1-server
154
155
156 RUN ldconfig
157 RUN sysctl -w net.ipv6.conf.lo.disable_ipv6=1
158
159 ##ENV  PYTHONHOME=/opt/python3 \
160 ##     PYTHONPATH=/opt/python3 \
161 ENV  RMR_RTG_SVC="9999" \
162      LD_LIBRARY_PATH="/usr/local/lib:/usr/local/libexec" \
163      NAME=ADM_CTRL_XAPP \
164      PORT=tcp:4560 \
165      THREADS=1\
166      VERBOSE=0 \
167      MESSAGE_TYPE=10002 \
168      RATE=1 \
169      CONFIG_FILE=/opt/ric/config/config-file.json
170      
171       
172
173 CMD python3 /etc/xapp/init_script.py $CONFIG_FILE