blob: 1e29e25ba8a2bbd6f502438f4be7712a52e7bbef [file] [log] [blame]
Ron Shachame7dfeb82020-04-24 14:46:48 -04001# 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 Danielsf7b69b82020-04-28 14:17:08 -040021# Abstract: This dockerfile is used to create an image that can be used to
22# run the traffic steering xAPP in a container.
Ron Shachame7dfeb82020-04-24 14:46:48 -040023#
24# Building should be as simple as:
25#
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040026# docker build -f Dockerfile -t ric-app-ts:[version]
Ron Shachame7dfeb82020-04-24 14:46:48 -040027#
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040028# Date: 27 April 2020
Ron Shachame7dfeb82020-04-24 14:46:48 -040029# Author: E. Scott Daniels
30# --------------------------------------------------------------------------------------
31
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040032# 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#
35FROM nexus3.o-ran-sc.org:10004/bldr-ubuntu18-c-go:7-u18.04 as buildenv
Ron Shachame7dfeb82020-04-24 14:46:48 -040036
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040037# spaces to save things in the build image to copy to final image
38RUN mkdir -p /playpen/assets /playpen/src /playpen/bin
Ron Shachame7dfeb82020-04-24 14:46:48 -040039ARG SRC=.
40
41WORKDIR /playpen
Ron Shachame7dfeb82020-04-24 14:46:48 -040042
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040043# versions we snarf from package cloud
44ARG RMR_VER=4.0.2
45ARG SDL_VER=1.0.4
46ARG XFCPP_VER=1.0.0
Ron Shachame7dfeb82020-04-24 14:46:48 -040047
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040048# package cloud urls for wget
49ARG PC_REL_URL=https://packagecloud.io/o-ran-sc/release/packages/debian/stretch
50ARG PC_STG_URL=https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch
Ron Shachame7dfeb82020-04-24 14:46:48 -040051
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040052# pull in rmr
53RUN 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 Shachame7dfeb82020-04-24 14:46:48 -040056
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040057# pull in xapp framework c++
58RUN 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 Shachame7dfeb82020-04-24 14:46:48 -040061
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040062# snarf up SDL dependencies, then pull SDL package and install
63RUN apt-get update
64RUN apt-get install -y libboost-filesystem1.65.1 libboost-system1.65.1 libhiredis0.13
65RUN 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 Shachame7dfeb82020-04-24 14:46:48 -040068
69
Ron Shachame7dfeb82020-04-24 14:46:48 -040070#
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040071# build and install the application
Ron Shachame7dfeb82020-04-24 14:46:48 -040072#
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040073COPY examples/* /playpen/src/
74RUN cd /playpen/src && make && make install
Ron Shachame7dfeb82020-04-24 14:46:48 -040075
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040076
77# non-programme things that we need to push to final image
Ron Shachame7dfeb82020-04-24 14:46:48 -040078#
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040079COPY assets/bootstrap.rt /playpen/assets
Ron Shachame7dfeb82020-04-24 14:46:48 -040080
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040081#
82# any scripts that are needed; copy to /playpen/bin
83#
Ron Shachame7dfeb82020-04-24 14:46:48 -040084
85
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040086
87# ----- create final, smaller, image ----------------------------------
Ron Shachame7dfeb82020-04-24 14:46:48 -040088FROM ubuntu:18.04
89
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040090# 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
92RUN 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 Shachame7dfeb82020-04-24 14:46:48 -040096#
Ron Shachame7dfeb82020-04-24 14:46:48 -040097COPY --from=buildenv /usr/local/lib /usr/local/lib/
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040098COPY --from=buildenv /usr/local/bin/rmr_probe /usr/local/bin/ts_xapp /usr/local/bin/
Ron Shachame7dfeb82020-04-24 14:46:48 -040099COPY --from=buildenv /usr/lib /usr/lib/
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400100COPY --from=buildenv /playpen/bin /usr/local/bin/
101COPY --from=buildenv /playpen/assets /data
Ron Shachame7dfeb82020-04-24 14:46:48 -0400102
103
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400104ENV PATH=/usr/local/bin:$PATH
Ron Shachame7dfeb82020-04-24 14:46:48 -0400105ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
Ron Shachame7dfeb82020-04-24 14:46:48 -0400106
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400107#ENV RMR_SEED_RT="routes.txt"
Ron Shachame7dfeb82020-04-24 14:46:48 -0400108
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400109WORKDIR /data
110COPY --from=buildenv /playpen/assets/* /data
Ron Shachame7dfeb82020-04-24 14:46:48 -0400111
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400112# if needed, set RMR vars
113#ENV RMR_RTG_SVC=rm-host:port
114#ENV RMR_VCTL_FILE=/tmp/rmr.v
115ENV RMR_SEED_RT=/data/bootstrap.rt
Ron Shachame7dfeb82020-04-24 14:46:48 -0400116
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400117#CMD [ "ts_xapp_start.sh" ]
118CMD [ "/usr/local/bin/ts_xapp" ]