blob: bc7b63eb992c3064683fd39cb8f3ee82abedf82a [file] [log] [blame]
E. Scott Daniels4e4fb502020-03-24 12:28:06 -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
21# Abstract: This can be used to create a base environment for using the xAPP
22# framework. It will install RMR and the framework libraries. It also
23# installs make and g++ so that it can be used as a builder environment.
24#
25# The unit tests are executed as a part of the build process; if they are
26# not passing then the build will fail.
27#
28# Building should be as simple as:
29#
30# docker build -f Dockerfile -t ricxfcpp:[version]
31#
32# Date: 23 March 2020
33# Author: E. Scott Daniels
34# --------------------------------------------------------------------------------------
35
36
sandeepindia488447a2022-04-22 22:58:51 +053037FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu20-c-go:1.0.0 as buildenv
E. Scott Daniels4e4fb502020-03-24 12:28:06 -040038RUN mkdir /playpen
39
40RUN apt-get update && apt-get install -y cmake gcc make git g++ wget
41
42RUN mkdir /playpen/bin /playpen/factory /playpen/factory/src /playpen/factory/test
43ARG SRC=.
44
45WORKDIR /playpen
46# Install RMr (runtime and dev) from debian package cached on packagecloud.io
czichy4969fbc2023-12-13 07:25:32 +020047ARG RMR_VER=4.9.4
E. Scott Daniels4e4fb502020-03-24 12:28:06 -040048
49# if package cloud is actually working, this is preferred
50#
51#RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr_${RMR_VER}_amd64.deb/download.deb
52#RUN wget -nv --content-disposition https://packagecloud.io/o-ran-sc/staging/packages/debian/stretch/rmr-dev_${RMR_VER}_amd64.deb/download.deb
53#RUN dpkg -i rmr_${RMR_VER}_amd64.deb
54#RUN dpkg -i rmr-dev_${RMR_VER}_amd64.deb
55#
56# else this:
57#
58COPY ${SRC}/build_rmr.sh /playpen/bin
59RUN bash /playpen/bin/build_rmr.sh -t ${RMR_VER}
60
sandeepindiae64778d2022-12-06 00:17:19 +053061#building cpprestsdk
62RUN apt-get install -y libcpprest-dev
63
64RUN apt-get install -y g++ git libboost-atomic-dev libboost-thread-dev libboost-system-dev libboost-date-time-dev libboost-regex-dev libboost-filesystem-dev libboost-random-dev libboost-chrono-dev libboost-serialization-dev libwebsocketpp-dev openssl libssl-dev ninja-build zlib1g-dev
65
66RUN git clone https://github.com/Microsoft/cpprestsdk.git casablanca && \
67 cd casablanca && \
68 mkdir build && \
69 cd build && \
70 cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
71 ninja && \
72 ninja install && \
73 cmake -G Ninja .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=0 -DBUILD_TESTS=OFF -DBUILD_SAMPLES=OFF -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
74 ninja && \
75 ninja install && \
76 rm -rf casablanca
77#installing all dependicies for pistache
78RUN apt-get update && apt-get install -y cmake gcc make \
79git g++ wget meson libcurl4-openssl-dev libssl-dev pkg-config ninja-build
80
81 RUN git clone https://github.com/Tencent/rapidjson && \
82 cd rapidjson && \
83 mkdir build && \
84 cd build && \
85 cmake -DCMAKE_INSTALL_PREFIX=/usr/local .. && \
86 make install && \
87 cd ../../
88 #rm -rf rapidjson
89
90#building and installing pistache
91RUN git clone https://github.com/pistacheio/pistache.git
92RUN cd pistache && \
czichy4969fbc2023-12-13 07:25:32 +020093 git checkout 363629b8804177a1e743cecfb880eed552922729 && \
sandeepindiae64778d2022-12-06 00:17:19 +053094 meson setup build \
95 --buildtype=release \
96 -DPISTACHE_USE_SSL=true \
97 -DPISTACHE_BUILD_EXAMPLES=true \
98 -DPISTACHE_BUILD_TESTS=true \
99 -DPISTACHE_BUILD_DOCS=false \
100 --prefix="/usr/local"
101RUN cd pistache/build && \
102 ninja && \
103 ninja install
104RUN cp /usr/local/lib/x86_64-linux-gnu/libpistache* /usr/local/lib/
105RUN cp /usr/local/lib/x86_64-linux-gnu/pkgconfig/libpistache.pc /usr/local/lib/pkgconfig
106
107#install nlohmann json
108RUN git clone https://github.com/nlohmann/json.git && cd json && cmake . && make install
109
110#install json-schema-validator
czichyc56c9df2023-06-08 14:48:50 +0300111RUN git clone https://github.com/pboettch/json-schema-validator.git && cd json-schema-validator && git checkout cae6fad80001510077a7f40e68477a31ec443add &&mkdir build &&cd build && cmake .. && make install
E. Scott Daniels4e4fb502020-03-24 12:28:06 -0400112
sandeepindia488447a2022-04-22 22:58:51 +0530113#copy the content as git repo inside the container.
114#COPY ${SRC}/CMakeLists.txt /playpen/factory/
115#COPY ${SRC}/src /playpen/factory/src/
116#COPY ${SRC}/test /playpen/factory/test/
117COPY ${SRC}/examples /tmp/examples/
118COPY . /playpen/factory
119
E. Scott Daniels4e4fb502020-03-24 12:28:06 -0400120
121# Go to the factory and build our stuff
122#
123ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
124ENV C_INCLUDE_PATH=/usr/local/include
125RUN cd /playpen/factory; rm -fr .build; mkdir .build; cd .build; cmake .. -DDEV_PKG=1; make install; cmake .. -DDEV_PKG=0; make install
126
127
sandeepindia488447a2022-04-22 22:58:51 +0530128
129
130#
131# Run unit tests will come after building process
132#
133COPY ${SRC}/test/* /playpen/factory/test/
134RUN cd /playpen/factory/test; bash unit_test.sh
135
136
E. Scott Daniels4e4fb502020-03-24 12:28:06 -0400137# ----- final, smaller image ----------------------------------
sandeepindiae64778d2022-12-06 00:17:19 +0530138#FROM ubuntu:20.04
139FROM nexus3.o-ran-sc.org:10002/o-ran-sc/bldr-ubuntu20-c-go:1.0.0
E. Scott Daniels4e4fb502020-03-24 12:28:06 -0400140# must add compile tools to make it a builder environmnent. If a build environment isn't needed
141# comment out the next line and reduce the image size by more than 180M.
142#
143RUN apt-get update && apt-get install -y --no-install-recommends make g++
144
145# if bash doesn't cut it for run_replay grab a real shell and clean up as much as we can
sandeepindiae64778d2022-12-06 00:17:19 +0530146#RUN apt-get update; apt-get install -y ksh
E. Scott Daniels4e4fb502020-03-24 12:28:06 -0400147RUN rm -fr /var/lib/apt/lists
148
149RUN mkdir -p /usr/local/include/ricxfcpp
150COPY --from=buildenv /usr/local/lib /usr/local/lib/
151COPY --from=buildenv /usr/local/include/ricxfcpp /usr/local/include/ricxfcpp/
152COPY --from=buildenv /usr/local/include/rmr /usr/local/include/rmr/
sandeepindiae64778d2022-12-06 00:17:19 +0530153COPY --from=buildenv /usr/local/include/cpprest /usr/local/include/cpprest/
154COPY --from=buildenv /usr/local/include/pplx /usr/local/include/pplx/
155COPY --from=buildenv /usr/local/include/pistache /usr/local/include/pistache/
E. Scott Daniels4e4fb502020-03-24 12:28:06 -0400156
157ENV LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib
158ENV C_INCLUDE_PATH=/usr/local/include
159WORKDIR /factory
160
161CMD [ "make" ]
sandeepindiae64778d2022-12-06 00:17:19 +0530162