blob: c68446637baa39688055789b016596cd33c03440 [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#
Alexandre Huffb86721b2021-05-28 13:32:02 -030026# 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# the builder has: git, wget, cmake, gcc/g++, make, python2/3. v7 dropped nng support
33#
Alexandre Huff05b94382021-12-09 00:29:05 -030034FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu20-c-go:1.0.0 as buildenv
Ron Shachame7dfeb82020-04-24 14:46:48 -040035
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040036# spaces to save things in the build image to copy to final image
37RUN mkdir -p /playpen/assets /playpen/src /playpen/bin
Ron Shachame7dfeb82020-04-24 14:46:48 -040038ARG SRC=.
39
40WORKDIR /playpen
Ron Shachame7dfeb82020-04-24 14:46:48 -040041
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040042# versions we snarf from package cloud
Alexandre Huffb86721b2021-05-28 13:32:02 -030043ARG RMR_VER=4.7.4
44# ARG SDL_VER=1.0.4
45ARG XFCPP_VER=2.3.3
Ron Shachame7dfeb82020-04-24 14:46:48 -040046
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040047# package cloud urls for wget
48ARG PC_REL_URL=https://packagecloud.io/o-ran-sc/release/packages/debian/stretch
Alexandre Huffb86721b2021-05-28 13:32:02 -030049# ARG PC_STG_URL=https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch
Ron Shachame7dfeb82020-04-24 14:46:48 -040050
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040051# pull in rmr
52RUN 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 Shachame7dfeb82020-04-24 14:46:48 -040055
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040056# pull in xapp framework c++
Alexandre Huffb86721b2021-05-28 13:32:02 -030057RUN 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 Danielsf7b69b82020-04-28 14:17:08 -040059 dpkg -i ricxfcpp-dev_${XFCPP_VER}_amd64.deb ricxfcpp_${XFCPP_VER}_amd64.deb
Ron Shachame7dfeb82020-04-24 14:46:48 -040060
Alexandre Huffb86721b2021-05-28 13:32:02 -030061# # 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 Shachame7dfeb82020-04-24 14:46:48 -040067
Ron Shachame187d502020-05-08 12:14:44 -040068RUN 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 Daniels3f200ee2020-05-20 17:34:17 -040076
Alexandre Huff05b94382021-12-09 00:29:05 -030077# install curl and gRPC dependencies
78RUN apt-get update && apt-get install -y \
79 libcurl4-openssl-dev \
80 libprotobuf-dev \
81 libgrpc++-dev
Ron Shachame7dfeb82020-04-24 14:46:48 -040082
Ron Shachame7dfeb82020-04-24 14:46:48 -040083#
E. Scott Danielsf7b96952020-04-29 10:07:53 -040084# build and install the application(s)
Ron Shachame7dfeb82020-04-24 14:46:48 -040085#
E. Scott Danielsf7b96952020-04-29 10:07:53 -040086COPY . /playpen/src/
87RUN cd /playpen/src && \
88 rm -fr .build &&\
89 mkdir .build && \
90 cd .build && \
91 cmake .. && \
92 make install
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040093
94# non-programme things that we need to push to final image
Ron Shachame7dfeb82020-04-24 14:46:48 -040095#
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040096COPY assets/bootstrap.rt /playpen/assets
Ron Shachame7dfeb82020-04-24 14:46:48 -040097
E. Scott Danielsf7b69b82020-04-28 14:17:08 -040098#
99# any scripts that are needed; copy to /playpen/bin
100#
Ron Shachame7dfeb82020-04-24 14:46:48 -0400101
102
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400103# ----- create final, smaller, image ----------------------------------
Alexandre Huff05b94382021-12-09 00:29:05 -0300104FROM ubuntu:20.04
Ron Shachame7dfeb82020-04-24 14:46:48 -0400105
Alexandre Huffb86721b2021-05-28 13:32:02 -0300106# # 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 Daniels3f200ee2020-05-20 17:34:17 -0400110
Alexandre Huffb86721b2021-05-28 13:32:02 -0300111# # 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 Daniels3f200ee2020-05-20 17:34:17 -0400118
Alexandre Huffb86721b2021-05-28 13:32:02 -0300119# RUN rm -fr /var/lib/apt/lists
120
Alexandre Huff05b94382021-12-09 00:29:05 -0300121# install curl and gRPC dependencies in the final image
122RUN 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 Danielsf7b69b82020-04-28 14:17:08 -0400128
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 Shachame7dfeb82020-04-24 14:46:48 -0400131#
Ron Shachame7dfeb82020-04-24 14:46:48 -0400132COPY --from=buildenv /usr/local/lib /usr/local/lib/
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400133COPY --from=buildenv /usr/local/bin/rmr_probe /usr/local/bin/ts_xapp /usr/local/bin/
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400134COPY --from=buildenv /playpen/bin /usr/local/bin/
135COPY --from=buildenv /playpen/assets /data
Ron Shachame7dfeb82020-04-24 14:46:48 -0400136
137
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400138ENV PATH=/usr/local/bin:$PATH
Ron Shachame7dfeb82020-04-24 14:46:48 -0400139ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
Ron Shachame7dfeb82020-04-24 14:46:48 -0400140
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400141WORKDIR /data
142COPY --from=buildenv /playpen/assets/* /data
Ron Shachame7dfeb82020-04-24 14:46:48 -0400143
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400144# if needed, set RMR vars
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400145ENV RMR_SEED_RT=/data/bootstrap.rt
E. Scott Danielsf7b96952020-04-29 10:07:53 -0400146#ENV RMR_RTG_SVC=rm-host:port
Ron Shacham535227c2020-06-08 11:02:14 -0400147ENV RMR_SRC_ID=service-ricxapp-trafficxapp-rmr.ricxapp:4560
E. Scott Danielsf7b96952020-04-29 10:07:53 -0400148ENV RMR_VCTL_FILE=/tmp/rmr.v
149RUN echo "2" >/tmp/rmr.v
Ron Shachame7dfeb82020-04-24 14:46:48 -0400150
E. Scott Danielsf7b69b82020-04-28 14:17:08 -0400151CMD [ "/usr/local/bin/ts_xapp" ]