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 | # |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [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 | # nexus seems to use ports rather than adding release, prod, staging to the url :( |
| 33 | # the builder has: git, wget, cmake, gcc/g++, make, python2/3. v7 dropped nng support |
| 34 | # |
| 35 | FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:7-u18.04 as buildenv |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 36 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 37 | # spaces to save things in the build image to copy to final image |
| 38 | RUN mkdir -p /playpen/assets /playpen/src /playpen/bin |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 39 | ARG SRC=. |
| 40 | |
| 41 | WORKDIR /playpen |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 42 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 43 | # versions we snarf from package cloud |
| 44 | ARG RMR_VER=4.0.2 |
| 45 | ARG SDL_VER=1.0.4 |
| 46 | ARG XFCPP_VER=1.0.0 |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 47 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 48 | # package cloud urls for wget |
| 49 | ARG PC_REL_URL=https://packagecloud.io/o-ran-sc/release/packages/debian/stretch |
| 50 | 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] | 51 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 52 | # pull in rmr |
| 53 | RUN wget -nv --content-disposition ${PC_REL_URL}/rmr_${RMR_VER}_amd64.deb/download.deb && \ |
| 54 | wget -nv --content-disposition ${PC_REL_URL}/rmr-dev_${RMR_VER}_amd64.deb/download.deb && \ |
| 55 | 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] | 56 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 57 | # pull in xapp framework c++ |
| 58 | RUN wget -nv --content-disposition ${PC_STG_URL}/ricxfcpp-dev_${XFCPP_VER}_amd64.deb/download.deb && \ |
| 59 | wget -nv --content-disposition ${PC_STG_URL}/ricxfcpp_${XFCPP_VER}_amd64.deb/download.deb && \ |
| 60 | 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] | 61 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 62 | # snarf up SDL dependencies, then pull SDL package and install |
| 63 | RUN apt-get update |
| 64 | RUN apt-get install -y libboost-filesystem1.65.1 libboost-system1.65.1 libhiredis0.13 |
| 65 | RUN wget -nv --content-disposition ${PC_STG_URL}/sdl_${SDL_VER}-1_amd64.deb/download.deb && \ |
| 66 | wget -nv --content-disposition ${PC_STG_URL}/sdl-dev_${SDL_VER}-1_amd64.deb/download.deb &&\ |
| 67 | 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] | 68 | |
| 69 | |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 70 | # |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 71 | # build and install the application |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 72 | # |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 73 | COPY examples/* /playpen/src/ |
| 74 | RUN cd /playpen/src && make && make install |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 75 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 76 | |
| 77 | # non-programme things that we need to push to final image |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 78 | # |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 79 | COPY assets/bootstrap.rt /playpen/assets |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 80 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 81 | # |
| 82 | # any scripts that are needed; copy to /playpen/bin |
| 83 | # |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 84 | |
| 85 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 86 | |
| 87 | # ----- create final, smaller, image ---------------------------------- |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 88 | FROM ubuntu:18.04 |
| 89 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 90 | # if bash doesn't cut it for something, grab ksh, then clean up as much as possible |
| 91 | #RUN apt-get update; apt-get install -y ksh |
| 92 | RUN rm -fr /var/lib/apt/lists |
| 93 | |
| 94 | # snarf the various sdl, rmr, and cpp-framework libraries as well as any binaries |
| 95 | # created (e.g. rmr_rprobe) and the application binary itself |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 96 | # |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 97 | COPY --from=buildenv /usr/local/lib /usr/local/lib/ |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 98 | COPY --from=buildenv /usr/local/bin/rmr_probe /usr/local/bin/ts_xapp /usr/local/bin/ |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 99 | COPY --from=buildenv /usr/lib /usr/lib/ |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 100 | COPY --from=buildenv /playpen/bin /usr/local/bin/ |
| 101 | COPY --from=buildenv /playpen/assets /data |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 102 | |
| 103 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 104 | ENV PATH=/usr/local/bin:$PATH |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 105 | ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 106 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 107 | #ENV RMR_SEED_RT="routes.txt" |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 108 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 109 | WORKDIR /data |
| 110 | COPY --from=buildenv /playpen/assets/* /data |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 111 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 112 | # if needed, set RMR vars |
| 113 | #ENV RMR_RTG_SVC=rm-host:port |
| 114 | #ENV RMR_VCTL_FILE=/tmp/rmr.v |
| 115 | ENV RMR_SEED_RT=/data/bootstrap.rt |
Ron Shacham | e7dfeb8 | 2020-04-24 14:46:48 -0400 | [diff] [blame] | 116 | |
E. Scott Daniels | f7b69b8 | 2020-04-28 14:17:08 -0400 | [diff] [blame^] | 117 | #CMD [ "ts_xapp_start.sh" ] |
| 118 | CMD [ "/usr/local/bin/ts_xapp" ] |