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 |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 21 | # Abstract: This dockerfile is used to create an image that can be used to |
| 22 | # run the traffic steering xAPP in a container. |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 23 | # |
| 24 | # Building should be as simple as: |
| 25 | # |
Alexandre Huff | b86721b | 2021-05-28 13:32:02 -0300 | [diff] [blame] | 26 | # docker build -f Dockerfile -t ric-app-ts:[version] . |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 27 | # |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 28 | # Date: 27 April 2020 |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 29 | # Author: E. Scott Daniels |
| 30 | # -------------------------------------------------------------------------------------- |
| 31 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 32 | # the builder has: git, wget, cmake, gcc/g++, make, python2/3. v7 dropped nng support |
| 33 | # |
Alexandre Huff | 05b9438 | 2021-12-09 00:29:05 -0300 | [diff] [blame] | 34 | FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu20-c-go:1.0.0 as buildenv |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 35 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 36 | # spaces to save things in the build image to copy to final image |
| 37 | RUN mkdir -p /playpen/assets /playpen/src /playpen/bin |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 38 | ARG SRC=. |
| 39 | |
| 40 | WORKDIR /playpen |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 41 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 42 | # versions we snarf from package cloud |
Alexandre Huff | b86721b | 2021-05-28 13:32:02 -0300 | [diff] [blame] | 43 | ARG RMR_VER=4.7.4 |
| 44 | # ARG SDL_VER=1.0.4 |
| 45 | ARG XFCPP_VER=2.3.3 |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 46 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 47 | # package cloud urls for wget |
| 48 | ARG PC_REL_URL=https://packagecloud.io/o-ran-sc/release/packages/debian/stretch |
Alexandre Huff | b86721b | 2021-05-28 13:32:02 -0300 | [diff] [blame] | 49 | # ARG PC_STG_URL=https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 50 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 51 | # pull in rmr |
| 52 | RUN wget -nv --content-disposition ${PC_REL_URL}/rmr_${RMR_VER}_amd64.deb/download.deb && \ |
| 53 | wget -nv --content-disposition ${PC_REL_URL}/rmr-dev_${RMR_VER}_amd64.deb/download.deb && \ |
| 54 | dpkg -i rmr_${RMR_VER}_amd64.deb rmr-dev_${RMR_VER}_amd64.deb |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 55 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 56 | # pull in xapp framework c++ |
Alexandre Huff | b86721b | 2021-05-28 13:32:02 -0300 | [diff] [blame] | 57 | RUN wget -nv --content-disposition ${PC_REL_URL}/ricxfcpp-dev_${XFCPP_VER}_amd64.deb/download.deb && \ |
| 58 | wget -nv --content-disposition ${PC_REL_URL}/ricxfcpp_${XFCPP_VER}_amd64.deb/download.deb && \ |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 59 | dpkg -i ricxfcpp-dev_${XFCPP_VER}_amd64.deb ricxfcpp_${XFCPP_VER}_amd64.deb |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 60 | |
Alexandre Huff | b86721b | 2021-05-28 13:32:02 -0300 | [diff] [blame] | 61 | # # snarf up SDL dependencies, then pull SDL package and install |
| 62 | # RUN apt-get update |
| 63 | # RUN apt-get install -y libboost-filesystem1.65.1 libboost-system1.65.1 libhiredis0.13 |
| 64 | # RUN wget -nv --content-disposition ${PC_STG_URL}/sdl_${SDL_VER}-1_amd64.deb/download.deb && \ |
| 65 | # wget -nv --content-disposition ${PC_STG_URL}/sdl-dev_${SDL_VER}-1_amd64.deb/download.deb &&\ |
| 66 | # dpkg -i sdl-dev_${SDL_VER}-1_amd64.deb sdl_${SDL_VER}-1_amd64.deb |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 67 | |
Ron Shacham | e187d50 | 2020-05-08 12:14:44 -0400 | [diff] [blame] | 68 | RUN git clone https://github.com/Tencent/rapidjson && \ |
| 69 | cd rapidjson && \ |
| 70 | mkdir build && \ |
| 71 | cd build && \ |
| 72 | cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \ |
| 73 | make install && \ |
| 74 | cd ${STAGE_DIR} && \ |
| 75 | rm -rf rapidjson |
E. Scott Daniels | 3f200ee | 2020-05-20 17:34:17 -0400 | [diff] [blame] | 76 | |
Alexandre Huff | 05b9438 | 2021-12-09 00:29:05 -0300 | [diff] [blame] | 77 | # install curl and gRPC dependencies |
| 78 | RUN apt-get update && apt-get install -y \ |
| 79 | libcurl4-openssl-dev \ |
| 80 | libprotobuf-dev \ |
| 81 | libgrpc++-dev |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 82 | |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 83 | # |
E. Scott Daniels | f7b9695 | 2020-04-29 10:07:53 -0400 | [diff] [blame] | 84 | # build and install the application(s) |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 85 | # |
E. Scott Daniels | f7b9695 | 2020-04-29 10:07:53 -0400 | [diff] [blame] | 86 | COPY . /playpen/src/ |
| 87 | RUN cd /playpen/src && \ |
| 88 | rm -fr .build &&\ |
| 89 | mkdir .build && \ |
| 90 | cd .build && \ |
| 91 | cmake .. && \ |
| 92 | make install |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 93 | |
| 94 | # non-programme things that we need to push to final image |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 95 | # |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 96 | COPY assets/bootstrap.rt /playpen/assets |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 97 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 98 | # |
| 99 | # any scripts that are needed; copy to /playpen/bin |
| 100 | # |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 101 | |
| 102 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 103 | # ----- create final, smaller, image ---------------------------------- |
Alexandre Huff | 05b9438 | 2021-12-09 00:29:05 -0300 | [diff] [blame] | 104 | FROM ubuntu:20.04 |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 105 | |
Alexandre Huff | b86721b | 2021-05-28 13:32:02 -0300 | [diff] [blame] | 106 | # # package cloud urls for wget |
| 107 | # ARG PC_REL_URL=https://packagecloud.io/o-ran-sc/release/packages/debian/stretch |
| 108 | # ARG PC_STG_URL=https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch |
| 109 | # ARG SDL_VER=1.0.4 |
E. Scott Daniels | 3f200ee | 2020-05-20 17:34:17 -0400 | [diff] [blame] | 110 | |
Alexandre Huff | b86721b | 2021-05-28 13:32:02 -0300 | [diff] [blame] | 111 | # # sdl doesn't install into /usr/local like everybody else, and we don't want to |
| 112 | # # hunt for it or copy all of /usr, so we must pull and reinstall it. |
| 113 | # RUN apt-get update |
| 114 | # RUN apt-get install -y libboost-filesystem1.65.1 libboost-system1.65.1 libhiredis0.13 wget |
| 115 | # RUN wget -nv --content-disposition ${PC_STG_URL}/sdl_${SDL_VER}-1_amd64.deb/download.deb && \ |
| 116 | # wget -nv --content-disposition ${PC_STG_URL}/sdl-dev_${SDL_VER}-1_amd64.deb/download.deb &&\ |
| 117 | # dpkg -i sdl-dev_${SDL_VER}-1_amd64.deb sdl_${SDL_VER}-1_amd64.deb |
E. Scott Daniels | 3f200ee | 2020-05-20 17:34:17 -0400 | [diff] [blame] | 118 | |
Alexandre Huff | b86721b | 2021-05-28 13:32:02 -0300 | [diff] [blame] | 119 | # RUN rm -fr /var/lib/apt/lists |
| 120 | |
Alexandre Huff | 05b9438 | 2021-12-09 00:29:05 -0300 | [diff] [blame] | 121 | # install curl and gRPC dependencies in the final image |
| 122 | RUN apt-get update && apt-get install -y \ |
| 123 | libcurl4-openssl-dev \ |
| 124 | libprotobuf-dev \ |
| 125 | libgrpc++-dev && \ |
| 126 | rm -rf /var/lib/apt/lists/* |
| 127 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 128 | |
| 129 | # snarf the various sdl, rmr, and cpp-framework libraries as well as any binaries |
| 130 | # created (e.g. rmr_rprobe) and the application binary itself |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 131 | # |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 132 | COPY --from=buildenv /usr/local/lib /usr/local/lib/ |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 133 | COPY --from=buildenv /usr/local/bin/rmr_probe /usr/local/bin/ts_xapp /usr/local/bin/ |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 134 | COPY --from=buildenv /playpen/bin /usr/local/bin/ |
| 135 | COPY --from=buildenv /playpen/assets /data |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 136 | |
| 137 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 138 | ENV PATH=/usr/local/bin:$PATH |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 139 | ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 140 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 141 | WORKDIR /data |
| 142 | COPY --from=buildenv /playpen/assets/* /data |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 143 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 144 | # if needed, set RMR vars |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 145 | ENV RMR_SEED_RT=/data/bootstrap.rt |
E. Scott Daniels | f7b9695 | 2020-04-29 10:07:53 -0400 | [diff] [blame] | 146 | #ENV RMR_RTG_SVC=rm-host:port |
Ron Shacham | 535227c | 2020-06-08 11:02:14 -0400 | [diff] [blame] | 147 | ENV RMR_SRC_ID=service-ricxapp-trafficxapp-rmr.ricxapp:4560 |
E. Scott Daniels | f7b9695 | 2020-04-29 10:07:53 -0400 | [diff] [blame] | 148 | ENV RMR_VCTL_FILE=/tmp/rmr.v |
| 149 | RUN echo "2" >/tmp/rmr.v |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 150 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame] | 151 | CMD [ "/usr/local/bin/ts_xapp" ] |