Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame^] | 1 | # vim: ts=4 sw=4 noet: |
| 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 | |
| 19 | # -------------------------------------------------------------------------------------- |
| 20 | # Mnemonic: Dockerfile |
| 21 | # Abstract: This can be used to create a base environment for using the xAPP |
| 22 | # framework. It will install RMR and the framework libraries. It also |
| 23 | # installs make and g++ so that it can be used as a builder environment. |
| 24 | # |
| 25 | # The unit tests are executed as a part of the build process; if they are |
| 26 | # not passing then the build will fail. |
| 27 | # |
| 28 | # Building should be as simple as: |
| 29 | # |
| 30 | # docker build -f Dockerfile -t ricxfcpp:[version] |
| 31 | # |
| 32 | # Date: 23 March 2020 |
| 33 | # Author: E. Scott Daniels |
| 34 | # -------------------------------------------------------------------------------------- |
| 35 | |
| 36 | |
| 37 | FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:6-u18.04-nng as buildenv |
| 38 | RUN mkdir /playpen |
| 39 | |
| 40 | RUN apt-get update && apt-get install -y cmake gcc make git g++ wget |
| 41 | |
| 42 | RUN mkdir /playpen/bin /playpen/factory /playpen/factory/src /playpen/factory/test |
| 43 | ARG SRC=. |
| 44 | |
| 45 | WORKDIR /playpen |
| 46 | # Install RMr (runtime and dev) from debian package cached on packagecloud.io |
| 47 | ARG RMR_VER=3.6.2 |
| 48 | |
| 49 | # if package cloud is actually working, this is preferred |
| 50 | # |
| 51 | #RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_${RMR_VER}_amd64.deb/download.deb |
| 52 | #RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_${RMR_VER}_amd64.deb/download.deb |
| 53 | #RUN dpkg -i rmr_${RMR_VER}_amd64.deb |
| 54 | #RUN dpkg -i rmr-dev_${RMR_VER}_amd64.deb |
| 55 | # |
| 56 | # else this: |
| 57 | # |
| 58 | RUN git config --global http.proxy http://one.proxy.att.com:8080 |
| 59 | |
| 60 | |
| 61 | RUN apt-get install -y cpputest |
| 62 | RUN apt-get remove -y libboost-all-dev |
| 63 | RUN apt-get install -y libboost-all-dev |
| 64 | RUN apt-get install -y libhiredis-dev |
| 65 | RUN apt-get install -y valgrind |
| 66 | |
| 67 | |
| 68 | RUN git clone https://gerrit.o-ran-sc.org/r/ric-plt/sdl |
| 69 | RUN cd sdl && \ |
| 70 | ./autogen.sh && \ |
| 71 | ./configure && \ |
| 72 | make all && \ |
| 73 | # make test && \ |
| 74 | make install |
| 75 | |
| 76 | |
| 77 | COPY ${SRC}/build_rmr.sh /playpen/bin |
| 78 | RUN bash /playpen/bin/build_rmr.sh -t ${RMR_VER} |
| 79 | |
| 80 | COPY ${SRC}/CMakeLists.txt /playpen/factory/ |
| 81 | COPY ${SRC}/src /playpen/factory/src/ |
| 82 | COPY ${SRC}/test /playpen/factory/test/ |
| 83 | #COPY ${SRC}/examples /tmp/examples/ |
| 84 | |
| 85 | |
| 86 | COPY ${SRC}/examples /playpen/factory/examples |
| 87 | COPY ${SRC}/routes.txt /playpen/factory/examples |
| 88 | |
| 89 | # |
| 90 | # Run unit tests |
| 91 | # |
| 92 | COPY ${SRC}/test/* /playpen/factory/test/ |
| 93 | RUN cd /playpen/factory/test; bash unit_test.sh |
| 94 | |
| 95 | # Go to the factory and build our stuff |
| 96 | # |
| 97 | ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:/usr/lib |
| 98 | ENV C_INCLUDE_PATH=/usr/local/include |
| 99 | RUN cd /playpen/factory; rm -fr .build; mkdir .build; cd .build; cmake .. -DDEV_PKG=1; make install; cmake .. -DDEV_PKG=0; make install |
| 100 | |
| 101 | RUN cd /playpen/factory/examples; make |
| 102 | |
| 103 | RUN ls /usr/local/lib |
| 104 | |
| 105 | |
| 106 | # ----- final, smaller image ---------------------------------- |
| 107 | FROM ubuntu:18.04 |
| 108 | |
| 109 | # must add compile tools to make it a builder environmnent. If a build environment isn't needed |
| 110 | # comment out the next line and reduce the image size by more than 180M. |
| 111 | # |
| 112 | RUN apt-get update && apt-get install -y --no-install-recommends make g++ |
| 113 | |
| 114 | # if bash doesn't cut it for run_replay grab a real shell and clean up as much as we can |
| 115 | RUN apt-get update; apt-get install -y ksh |
| 116 | RUN rm -fr /var/lib/apt/lists |
| 117 | |
| 118 | RUN mkdir -p /usr/local/include/ricxfcpp |
| 119 | COPY --from=buildenv /usr/local/lib /usr/local/lib/ |
| 120 | COPY --from=buildenv /usr/local/include/ricxfcpp /usr/local/include/ricxfcpp/ |
| 121 | COPY --from=buildenv /usr/local/include/rmr /usr/local/include/rmr/ |
| 122 | COPY --from=buildenv /usr/local/lib /usr/local/lib |
| 123 | COPY --from=buildenv /usr/lib /usr/lib/ |
| 124 | |
| 125 | RUN mkdir -p /examples/ |
| 126 | COPY --from=buildenv /playpen/factory/examples/ts_xapp /examples/ |
| 127 | COPY --from=buildenv /playpen/factory/examples/routes.txt /examples/ |
| 128 | |
| 129 | |
| 130 | ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib |
| 131 | ENV C_INCLUDE_PATH=/usr/local/include |
| 132 | |
| 133 | ENV RMR_SEED_RT="routes.txt" |
| 134 | |
| 135 | #WORKDIR /factory |
| 136 | |
| 137 | WORKDIR /examples/ |
| 138 | |
| 139 | #CMD [ "make" ] |
| 140 | |
| 141 | CMD ./ts_xapp |