sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 1 | #/* |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 2 | ##================================================================================== |
| 3 | ## |
sjana | b3dbe86 | 2021-02-25 23:17:53 -0800 | [diff] [blame^] | 4 | ## Copyright (c) 2020-2021 AT&T Intellectual Property. |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 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 | |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 20 | ARG SCHEMA_PATH=schemas |
sjana | b3dbe86 | 2021-02-25 23:17:53 -0800 | [diff] [blame^] | 21 | ARG STAGE_DIR=/tmp/helloworld-xapp-unittests |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 22 | |
| 23 | #================================================================================== |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 24 | FROM nexus3.o-ran-sc.org:10001/ubuntu:18.04 as ricbuild |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 25 | |
| 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 |
| 29 | ARG SCHEMA_FILE |
| 30 | ARG SCHEMA_PATH |
| 31 | ARG STAGE_DIR |
| 32 | |
| 33 | # Install necessary packages |
| 34 | WORKDIR ${STAGE_DIR} |
| 35 | RUN apt-get update \ |
| 36 | && apt-get install -y \ |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 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 |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 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 |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 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 |
sjana | 45fd367 | 2020-12-10 13:42:50 -0500 | [diff] [blame] | 59 | ARG RMR_VER=4.4.6 |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 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 |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 62 | RUN dpkg -i rmr_${RMR_VER}_amd64.deb |
| 63 | RUN dpkg -i rmr-dev_${RMR_VER}_amd64.deb |
| 64 | |
| 65 | ##Iinstall Google test |
| 66 | |
| 67 | WORKDIR ${STAGE_DIR} |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 68 | RUN apt-get install -y libgtest-dev |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 69 | RUN cd /usr/src/gtest \ |
| 70 | && cmake CMakeLists.txt \ |
| 71 | && make \ |
| 72 | && cp *.a /usr/local/lib |
| 73 | |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 74 | #Install RNIB libraries |
| 75 | ARG RNIB_VER=1.0.0 |
| 76 | RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/rnib_${RNIB_VER}_all.deb/download.deb |
| 77 | RUN dpkg -i rnib_${RNIB_VER}_all.deb |
| 78 | |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 79 | |
sjana | b3dbe86 | 2021-02-25 23:17:53 -0800 | [diff] [blame^] | 80 | #Install ASN1C library package hosted at packagecloud.io |
| 81 | ARG ASN1C_VER=1.0.0 |
| 82 | RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/riclibe2ap_${ASN1C_VER}_amd64.deb/download.deb |
| 83 | RUN wget --content-disposition https://packagecloud.io/o-ran-sc/release/packages/debian/stretch/riclibe2ap-dev_${ASN1C_VER}_amd64.deb/download.deb |
| 84 | RUN dpkg -i riclibe2ap_${ASN1C_VER}_amd64.deb |
| 85 | RUN dpkg -i riclibe2ap-dev_${ASN1C_VER}_amd64.deb |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 90 | ## Install SDL Libraries |
| 91 | WORKDIR ${STAGE_DIR} |
| 92 | RUN apt-get install -y cpputest |
| 93 | RUN apt-get remove -y libboost-all-dev |
| 94 | RUN apt-get install -y libboost-all-dev |
| 95 | RUN apt-get install -y libhiredis-dev |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 96 | |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 97 | RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/dbaas |
| 98 | RUN cd dbaas/redismodule && \ |
| 99 | ./autogen.sh && \ |
| 100 | ./configure && \ |
| 101 | make all && \ |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 102 | make install |
| 103 | |
| 104 | WORKDIR ${STAGE_DIR} |
| 105 | RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl |
| 106 | RUN cd sdl && \ |
| 107 | ./autogen.sh && \ |
| 108 | ./configure && \ |
| 109 | make all && \ |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 110 | make install |
| 111 | |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 112 | |
| 113 | WORKDIR ${STAGE_DIR} |
| 114 | ## Install rapidjson |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 115 | |
| 116 | RUN 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 | |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 125 | ##----------------------------------- |
| 126 | # Now install the program |
| 127 | #------------------------------------ |
| 128 | COPY ./ ${STAGE_DIR} |
| 129 | RUN ls -al |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 130 | |
| 131 | RUN export CPATH=$CPATH:/usr/local/include && \ |
| 132 | cd test && \ |
| 133 | make clean && \ |
| 134 | make install |
| 135 | |
| 136 | COPY ${SCHEMA_PATH}/* /etc/xapp/ |
| 137 | COPY init/init_script.py /etc/xapp/init_script.py |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 138 | COPY init/routes.txt /etc/xapp/routes.txt |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 139 | |
| 140 | #--------------------------------------------- |
| 141 | # #Build the final version |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 142 | |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 143 | FROM ubuntu:18.04 |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 144 | |
| 145 | ARG SCHEMA_PATH |
| 146 | ARG STAGE_DIR |
| 147 | |
| 148 | ## copy just the needed libraries install it into the final image |
| 149 | COPY --from=ricbuild ${STAGE_DIR}/*.deb /tmp/ |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 150 | COPY --from=ricbuild /usr/local/lib/librmr_si* /usr/local/lib/ |
| 151 | COPY --from=ricbuild /usr/local/lib/libgtest* /usr/local/lib/ |
| 152 | COPY --from=ricbuild /usr/local/lib/libsdl* /usr/local/lib/ |
sjana | b3dbe86 | 2021-02-25 23:17:53 -0800 | [diff] [blame^] | 153 | COPY --from=ricbuild /usr/local/include/riclibe2ap /usr/local/include/ |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 154 | COPY --from=ricbuild /usr/local/libexec/redismodule/libredis* /usr/local/libexec/redismodule/ |
| 155 | RUN dpkg -i /tmp/*.deb |
| 156 | RUN 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 |
| 160 | COPY --from=ricbuild /etc/xapp/* /etc/xapp/ |
| 161 | COPY --from=ricbuild /usr/local/bin/hw_unit_tests /usr/local/bin/hw_unit_tests |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 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/ |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 164 | |
| 165 | |
| 166 | RUN ldconfig |
| 167 | |
| 168 | |
| 169 | ##ENV PYTHONHOME=/opt/python3 \ |
| 170 | ## PYTHONPATH=/opt/python3 \ |
| 171 | ENV RMR_RTG_SVC="9999" \ |
sjana | e1d5c65 | 2020-05-08 15:32:58 -0400 | [diff] [blame] | 172 | RMR_SEED_RT="/etc/xapp/routes.txt" \ |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 173 | LD_LIBRARY_PATH="/usr/local/lib:/usr/local/libexec" \ |
sjana | 60af3c9 | 2020-04-13 10:53:34 -0400 | [diff] [blame] | 174 | CONFIG_FILE=/opt/ric/config/config-file.json \ |
| 175 | EXE_FILE=/usr/local/bin/hw_unit_tests |
| 176 | |
| 177 | |
| 178 | CMD python3 /etc/xapp/init_script.py $CONFIG_FILE $EXE_FILE |