2 #==================================================================================
3 # Copyright (c) 2018-2019 AT&T Intellectual Property.
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
9 # http://www.apache.org/licenses/LICENSE-2.0
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 #==================================================================================
19 # --------------------------------------------------------------------------------------
20 # Mnemonic: Dockerfile
21 # Abstract: This dockerfile is used to create an image that can be used to
22 # run the traffic steering xAPP in a container.
24 # Building should be as simple as:
26 # docker build -f Dockerfile -t ric-app-ts:[version] .
29 # Author: E. Scott Daniels
30 # --------------------------------------------------------------------------------------
32 # the builder has: git, wget, cmake, gcc/g++, make, python2/3. v7 dropped nng support
34 FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu18-c-go:1.9.0 as buildenv
36 # spaces to save things in the build image to copy to final image
37 RUN mkdir -p /playpen/assets /playpen/src /playpen/bin
42 # versions we snarf from package cloud
47 # package cloud urls for wget
48 ARG PC_REL_URL=https://packagecloud.io/o-ran-sc/release/packages/debian/stretch
49 # ARG PC_STG_URL=https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch
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
56 # pull in xapp framework c++
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 && \
59 dpkg -i ricxfcpp-dev_${XFCPP_VER}_amd64.deb ricxfcpp_${XFCPP_VER}_amd64.deb
61 # # snarf up SDL dependencies, then pull SDL package and install
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
68 RUN git clone https://github.com/Tencent/rapidjson && \
72 cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
77 # install TS curl dependencies
78 RUN apt-get update && \
79 apt-get install -y libcurl4-openssl-dev
82 # build and install the application(s)
85 RUN cd /playpen/src && \
92 # non-programme things that we need to push to final image
94 COPY assets/bootstrap.rt /playpen/assets
97 # any scripts that are needed; copy to /playpen/bin
101 # ----- create final, smaller, image ----------------------------------
104 # # package cloud urls for wget
105 # ARG PC_REL_URL=https://packagecloud.io/o-ran-sc/release/packages/debian/stretch
106 # ARG PC_STG_URL=https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch
109 # # sdl doesn't install into /usr/local like everybody else, and we don't want to
110 # # hunt for it or copy all of /usr, so we must pull and reinstall it.
112 # RUN apt-get install -y libboost-filesystem1.65.1 libboost-system1.65.1 libhiredis0.13 wget
113 # RUN wget -nv --content-disposition ${PC_STG_URL}/sdl_${SDL_VER}-1_amd64.deb/download.deb && \
114 # wget -nv --content-disposition ${PC_STG_URL}/sdl-dev_${SDL_VER}-1_amd64.deb/download.deb &&\
115 # dpkg -i sdl-dev_${SDL_VER}-1_amd64.deb sdl_${SDL_VER}-1_amd64.deb
117 # RUN rm -fr /var/lib/apt/lists
119 # install TS curl dependencies in the final image
120 RUN apt-get update && \
121 apt-get install -y libcurl4-openssl-dev && \
124 # snarf the various sdl, rmr, and cpp-framework libraries as well as any binaries
125 # created (e.g. rmr_rprobe) and the application binary itself
127 COPY --from=buildenv /usr/local/lib /usr/local/lib/
128 COPY --from=buildenv /usr/local/bin/rmr_probe /usr/local/bin/ts_xapp /usr/local/bin/
129 COPY --from=buildenv /playpen/bin /usr/local/bin/
130 COPY --from=buildenv /playpen/assets /data
133 ENV PATH=/usr/local/bin:$PATH
134 ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
137 COPY --from=buildenv /playpen/assets/* /data
139 # if needed, set RMR vars
140 ENV RMR_SEED_RT=/data/bootstrap.rt
141 #ENV RMR_RTG_SVC=rm-host:port
142 ENV RMR_SRC_ID=service-ricxapp-trafficxapp-rmr.ricxapp:4560
143 ENV RMR_VCTL_FILE=/tmp/rmr.v
144 RUN echo "2" >/tmp/rmr.v
147 ENV TS_CONTROL_URL=http://localhost:5000/api/echo
149 CMD [ "/usr/local/bin/ts_xapp" ]