Commit 14514d4a authored by Raphael Defosseux's avatar Raphael Defosseux

Merge branch 'build-simplification' into 'develop'

chore(build): simplification and cleanup

See merge request oai/cn5g/oai-cn5g-nrf!30
parents 7f19ae65 8cf46c0f
# RELEASE NOTES: #
## v1.4.0 -- July 2022 ##
* Remove unused packages
* Add NF profile handling for PCF
* HTTP/2 support for SBI interface
* Official images produced by CI are pushed to `oaisoftwarealliance` Docker-Hub Team account
* Reduce image size
## v1.3.0 -- January 2022 ##
* NF profile update
......
......@@ -25,15 +25,15 @@
#
#######################################
#SUPPORTED_DISTRO="Ubuntu 18.04, CentOS 7, RHEL 7"
SUPPORTED_DISTRO="Ubuntu 18.04,RHEL8"
SUPPORTED_DISTRO="Ubuntu 18.04,20.04,22.04, RHEL8"
if [ ! -f /etc/os-release ]; then
echo_fatal "No /etc/os-release file found. You're likely on an unsupported distro."
fi
OS_DISTRO=$(grep "^ID=" /etc/os-release | sed "s/ID=//" | sed "s/\"//g")
OS_RELEASE=$(grep "^VERSION_ID=" /etc/os-release | sed "s/VERSION_ID=//" | sed "s/\"//g")
case "$OS_DISTRO" in
fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake3" ;;
rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;;
fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake" ;;
rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake" ;;
centos) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;;
debian) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
ubuntu) OS_BASEDISTRO="debian"; INSTALLER="apt-get"; CMAKE="cmake" ;;
......@@ -128,6 +128,8 @@ check_supported_distribution() {
local distribution=$(get_distribution_release)
case "$distribution" in
"ubuntu18.04") return 0 ;;
"ubuntu20.04") return 0 ;;
"ubuntu22.04") return 0 ;;
"rhel8") return 0 ;;
"rhel8.2") return 0 ;;
"rhel8.3") return 0 ;;
......@@ -164,7 +166,10 @@ clean_kernel() {
#-------------------------------------------------------------------------------
disable_ipv6() {
$SUDO sysctl -w net.ipv6.conf.all.disable_ipv6=1
if [ $IS_CONTAINER -eq 0 ]
then
$SUDO sysctl -w net.ipv6.conf.all.disable_ipv6=1
fi
}
......
################################################################################
# Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The OpenAirInterface Software Alliance licenses this file to You under
# the OAI Public License, Version 1.1 (the "License"); you may not use this file
# except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.openairinterface.org/?page_id=698
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#-------------------------------------------------------------------------------
# For more information about the OpenAirInterface (OAI) Software Alliance:
# contact@openairinterface.org
################################################################################
# file build_helper.fb_folly
# brief
# author Lionel GAUTHIER
#
#######################################
SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_fb_folly_from_source(){
echo "Starting to install folly"
if [ $1 -eq 0 ]; then
OPTION=""
read -p "Do you want to install FaceBook folly (github)? <y/N> " prompt
else
prompt='y'
OPTION="-y"
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
if [[ $prompt =~ [yY](es)* ]]
then
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
$SUDO $INSTALLER install $OPTION \
gcc-c++ \
$CMAKE \
boost-devel \
libevent-devel \
double-conversion-devel \
glog-devel \
gflags-devel \
snappy-devel \
make \
lz4-devel \
zlib-devel \
binutils-devel \
jemalloc-devel \
openssl-devel \
pkg-config
ret=$?;[[ $ret -ne 0 ]] && return $ret
elif [[ $OS_DISTRO == "ubuntu" ]]; then
$SUDO $INSTALLER install $OPTION \
g++ \
cmake \
libboost-all-dev \
libevent-dev \
libdouble-conversion-dev \
libgoogle-glog-dev \
libgflags-dev \
libiberty-dev \
liblz4-dev \
liblzma-dev \
libsnappy-dev \
make \
zlib1g-dev \
binutils-dev \
libjemalloc-dev \
libssl-dev \
pkg-config
ret=$?;[[ $ret -ne 0 ]] && return $ret
fi
pushd /tmp
if [ $debug -eq 1 ]; then
# For advanced debugging options
$SUDO $INSTALLER install $OPTION \
libunwind8-dev \
libelf-dev \
libdwarf-dev
ret=$?;[[ $ret -ne 0 ]] && return $ret
wget https://github.com/google/googletest/archive/release-1.8.0.tar.gz && \
tar zxf release-1.8.0.tar.gz && \
rm -f release-1.8.0.tar.gz && \
cd googletest-release-1.8.0 && \
$CMAKE . && \
make && \
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
cd ..
fi
$SUDO rm -rf /tmp/folly
git clone https://github.com/facebook/folly.git
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
cd folly
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
git checkout -f v2019.06.17.00
echo 'diff --git a/build/fbcode_builder/CMake/FindGflags.cmake b/build/fbcode_builder/CMake/FindGflags.cmake' > patch.diff
echo 'index 246ceac..3b96716 100644' >> patch.diff
echo '--- a/build/fbcode_builder/CMake/FindGflags.cmake' >> patch.diff
echo '+++ b/build/fbcode_builder/CMake/FindGflags.cmake' >> patch.diff
echo '@@ -34,6 +34,9 @@ IF (LIBGFLAGS_INCLUDE_DIR)' >> patch.diff
echo ' ENDIF ()' >> patch.diff
echo '' >> patch.diff
echo ' find_package(gflags CONFIG QUIET)' >> patch.diff
echo '+get_filename_component (_LIB_PATH "${gflags_CONFIG}/../../../" ABSOLUTE)' >> patch.diff
echo '+unset(gflags_LIBRARIES)' >> patch.diff
echo '+find_library(gflags_LIBRARIES gflags PATHS ${_LIB_PATH})' >> patch.diff
echo ' if (gflags_FOUND)' >> patch.diff
echo ' if (NOT Gflags_FIND_QUIETLY)' >> patch.diff
echo ' message(STATUS "Found gflags from package config ${gflags_CONFIG}")' >> patch.diff
git apply patch.diff
else
git checkout -f v2019.11.11.00
fi
mkdir _build && cd _build
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
cmake3 ..
else
cmake ..
fi
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make -j $(nproc)
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo_success "folly installation complete"
return 0
}
......@@ -30,45 +30,7 @@
SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
source $THIS_SCRIPT_PATH/build_helper.libconfig
source $THIS_SCRIPT_PATH/build_helper.fb_folly
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_fmt() {
echo "Starting to install fmt"
if [ $1 -eq 0 ]; then
read -p "Do you want to install open-source formatting library for C++ ? <y/N> " prompt
OPTION=""
else
prompt='y'
OPTION="-y"
fi
echo "Install fmt from source"
if [[ $prompt =~ [yY](es)* ]]
then
cd /tmp
echo "Downloading fmt"
$SUDO rm -rf /tmp/fmt*
git clone https://github.com/fmtlib/fmt.git
ret=$?;[[ $ret -ne 0 ]] && return $ret
cd fmt
# Looks like since Nov 11 commits, we cannot build
git checkout -f 1936dddc3c53c1c0db55a665cf419dc7a257ba62
$CMAKE -DFMT_TEST=FALSE .
ret=$?;[[ $ret -ne 0 ]] && return $ret
make -j `nproc`
ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO make install
cd /tmp
rm -rf /tmp/fmt*
fi
echo "fmt installation complete"
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -144,21 +106,23 @@ install_pistache_from_git() {
cd pistache && git checkout e18ed9baeb2145af6f9ea41246cf48054ffd9907
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
$CMAKE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
$CMAKE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release \
-DPISTACHE_BUILD_EXAMPLES=false \
-DPISTACHE_BUILD_TESTS=false \
-DPISTACHE_BUILD_DOCS=false \
..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
make -j $(nproc)
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
rm -Rf $OPENAIRCN_DIR/build/ext/pistache/_build
fi
echo "pistache installation complete"
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -200,6 +164,7 @@ install_nlohmann_from_git() {
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
rm -Rf $OPENAIRCN_DIR/build/ext/json/_build
fi
echo "Nlohmann Json installation complete"
return 0
......@@ -229,7 +194,7 @@ install_nghttp2_from_git() {
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
g++ \
cmake \
$CMAKE \
binutils \
autoconf \
automake \
......@@ -240,7 +205,7 @@ install_nghttp2_from_git() {
libcunit1-dev \
libssl-dev \
libxml2-dev libev-dev libevent-dev libjansson-dev libc-ares-dev \
libjemalloc-dev libsystemd-dev cython python3-dev python-setuptools"
libjemalloc-dev libsystemd-dev python3-dev python-setuptools"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
gcc-c++ \
......@@ -260,7 +225,7 @@ install_nghttp2_from_git() {
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install build tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
GIT_URL=https://github.com/nghttp2/nghttp2.git
......@@ -283,20 +248,21 @@ install_nghttp2_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
autoconf
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
./configure --enable-asio-lib
./configure --enable-asio-lib --enable-lib-only
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
make -j $(nproc)
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO ldconfig
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
git clean -x -d -ff .
popd
fi
echo "nghttp2 installation complete"
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -309,41 +275,10 @@ install_cpp_jwt_from_git() {
prompt='y'
OPTION="-y"
fi
if [ $2 -eq 0 ]; then
debug=0
else
debug=1
fi
if [[ $prompt =~ [yY](es)* ]]
then
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
libgtest-dev \
libssl-dev"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
gtest-devel \
openssl-devel"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
#install libgtest
if [[ $OS_DISTRO == "ubuntu" ]]; then
echo "Building the gtest library"
pushd $OPENAIRCN_DIR/build/ext
cd /usr/src/gtest
$SUDO $CMAKE CMakeLists.txt
$SUDO make
$SUDO cp *.a /usr/lib
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
GIT_URL=https://github.com/arun11299/cpp-jwt.git
echo "Install Cpp-jwt from $GIT_URL"
pushd $OPENAIRCN_DIR/build/ext
......@@ -358,13 +293,16 @@ install_cpp_jwt_from_git() {
cd cpp-jwt && git checkout -f v1.4
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
$CMAKE ..
$CMAKE \
-DCPP_JWT_BUILD_TESTS=OFF \
-DCPP_JWT_BUILD_EXAMPLES=OFF ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
rm -Rf $OPENAIRCN_DIR/build/ext/cpp-jwt/_build
fi
echo "cpp_jwt installation complete"
return 0
......@@ -395,7 +333,9 @@ check_install_nrf_deps() {
#$SUDO systemctl mask apt-daily.timer
#$SUDO systemctl mask apt-daily-upgrade.service
#$SUDO systemctl mask apt-daily-upgrade.timer
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
if [ $IS_CONTAINER -eq 0 ]; then
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
fi
fi
update_package_db
......@@ -408,24 +348,16 @@ check_install_nrf_deps() {
PACKAGE_LIST="\
autoconf \
automake \
bison \
build-essential \
$CMAKE \
daemon \
doxygen \
flex \
gdb \
git"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
autoconf \
automake \
bison \
gcc-c++ \
$CMAKE \
make \
doxygen \
flex \
gdb \
git"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
......@@ -434,45 +366,44 @@ check_install_nrf_deps() {
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
# Libraries
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
;;
# Currently Ubuntu18.04 has boost 1.65 as the latest
# We need at least 1.66
# PPA has 1.67
$SUDO $INSTALLER install $OPTION software-properties-common
$SUDO add-apt-repository ppa:mhier/libboost-latest --yes
$SUDO $INSTALLER update
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan4"
;;
"ubuntu20.04")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan5"
;;
"ubuntu22.04")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan6"
;;
esac
# removed libspdlog-dev
PACKAGE_LIST="\
$specific_packages \
guile-2.0-dev \
libcurl4-gnutls-dev \
libevent-dev \
libgcrypt11-dev \
libgmp-dev \
libhogweed? \
libidn2-0-dev \
libidn11-dev \
libpthread-stubs0-dev \
libssl-dev \
libtool \
libxml2 \
libxml2-dev \
openssl \
python \
nettle-dev \
libcurl4 \
net-tools \
pkg-config"
pkg-config \
ninja-build"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
guile-devel \
libconfig-devel \
libgcrypt-devel \
gmp-devel \
libidn-devel \
lksctp-tools \
lksctp-tools-devel \
openssl-devel \
libtool \
libxml2 \
......@@ -482,28 +413,36 @@ check_install_nrf_deps() {
nettle-devel \
libcurl-devel \
python2 \
pkgconfig"
pkgconfig \
ninja-build \
boost-devel \
libasan"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install distro libs"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
# fix issue with libboost in U18 for a bare metal deployment
if [[ $OS_DISTRO == "ubuntu" ]]; then
case "$(get_distribution_release)" in
"ubuntu18.04")
$SUDO $INSTALLER remove $OPTION libboost1.65-dev || true
$SUDO $INSTALLER autoremove $OPTION || true
$SUDO $INSTALLER install $OPTION libboost1.67-dev
;;
esac
fi
ret=$?;[[ $ret -ne 0 ]] && return $ret
echo "distro libs installation complete"
# Use fmt lib included in spdlog
#install_fmt $1
#ret=$?;[[ $ret -ne 0 ]] && return $ret
install_spdlog_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_fb_folly_from_source $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_pistache_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
install_nlohmann_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
......
......@@ -187,7 +187,7 @@ pipeline {
echo "Maybe a previous build went wrong"
}
// In case of push to `develop` branch we build from scratch
myShCmd('docker build --no-cache --target oai-nrf --tag oai-nrf:' + nrf_tag + ' --file docker/Dockerfile.nrf.ubuntu18 . > archives/nrf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker build --no-cache --target oai-nrf --tag oai-nrf:' + nrf_tag + ' --file docker/Dockerfile.nrf.ubuntu . > archives/nrf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
if ("MERGE".equals(env.gitlabActionType)) {
try {
......@@ -252,7 +252,7 @@ pipeline {
myShCmd('cp /etc/pki/entitlement/*pem ./etc-pki-entitlement', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo cp /etc/rhsm/rhsm.conf ./rhsm-conf', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo cp /etc/rhsm/ca/*pem ./rhsm-ca', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman build --no-cache --target oai-nrf --tag oai-nrf:' + nrf_tag + ' --file docker/Dockerfile.nrf.rhel8 . > archives/nrf_podman_image_build.log 2>&1', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
myShCmd('sudo podman build --no-cache --target oai-nrf --tag oai-nrf:' + nrf_tag + ' --file docker/Dockerfile.nrf.rhel8 --format docker . > archives/nrf_podman_image_build.log 2>&1', rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
// Putting a place holder to try out on the flattening of image.
// If not satisfactory, we can remove it.
myShCmd('python3 ./ci-scripts/flatten_image.py --tag oai-nrf:' + nrf_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
......
......@@ -29,25 +29,27 @@
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
ARG BASE_IMAGE=ubuntu:bionic
FROM oai-nrf-base:latest as oai-nrf-builder
# Copying source code
WORKDIR /openair-nrf/
COPY . /openair-nrf
RUN cp -Rf /openair-nrf-ext-ref /openair-nrf/build/ext
# Building NRF
WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --clean --Verbose --build-type Release --jobs && \
RUN ldconfig && \
./build_nrf --clean --Verbose --build-type Release --jobs && \
ldd /openair-nrf/build/nrf/build/nrf && \
mv /openair-nrf/build/nrf/build/nrf /openair-nrf/build/nrf/build/oai_nrf
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-nrf
FROM $BASE_IMAGE as oai-nrf
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
......@@ -57,30 +59,44 @@ RUN apt-get update && \
iputils-ping \
bc \
tzdata \
libasan4 \
libgoogle-glog0v5 \
libdouble-conversion1 \
# Ubuntu 18 --> libasan4
# Ubuntu 20 --> libasan5
# Ubuntu 22 --> libasan6
libasan? \
libconfig++9v5 \
libldap-2.4-2 \
# Ubuntu 18/20 --> libldap-2.4-2
# Ubuntu 22 --> libldap-2.5-0
libldap-2.?-? \
libkrb5-3 \
libgssapi-krb5-2 \
libcurl4-gnutls-dev \
librtmp1 \
libpsl5 \
&& rm -rf /var/lib/apt/lists/*
# Ubuntu 18 --> boost62/65 -> will remove both
# Ubuntu 20 --> boost67/71 -> will remove 67
# Ubuntu 22 --> boost74
libboost-thread1.??.0 \
libboost-chrono1.??.0 \
&& rm -rf /var/lib/apt/lists/* \
/lib/x86_64-linux-gnu/libboost_system.so.1.6*.0 \
/lib/x86_64-linux-gnu/libboost_chrono.so.1.6*.0 \
/lib/x86_64-linux-gnu/libboost_thread.so.1.6*.0
# Copying executable and generated libraries
WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder \
/openair-nrf/build/nrf/build/oai_nrf \
/openair-nrf/scripts/entrypoint.sh \
/openair-nrf/scripts/healthcheck.sh \
./
COPY --from=oai-nrf-builder \
/usr/local/lib/libpistache.so \
# Copying only the packages built from source
/usr/local/lib/libnghttp2.so.14 \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \
/usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 \
/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 \
/usr/local/lib/libpistache.so \
# Ubuntu 18 --> boost 67 will be copied
/usr/lib/libboost_system.so.1.* \
/usr/lib/libboost_thread.so.1.* \
/usr/local/lib/
RUN ldconfig && \
......@@ -93,6 +109,11 @@ WORKDIR /openair-nrf
# expose ports
EXPOSE 80/tcp 9090/tcp
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-nrf/bin/healthcheck.sh
ENTRYPOINT ["/bin/bash","/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
......@@ -36,7 +36,7 @@ def _parse_args() -> argparse.Namespace:
'--tag', '-t',
action='store',
required=True,
help='Image Tag in image-name:image tag format',
help='Image Tag in image-name:image-tag format',
)
return parser.parse_args()
......@@ -49,6 +49,9 @@ def perform_flattening(tag):
if re.search('podman', podman_check.strip()):
cli = 'sudo podman'
image_prefix = 'localhost/'
# since HEALTHCHECK is not supported by podman import
# we don't flatten
return 0
if cli == '':
cmd = 'which docker || true'
docker_check = subprocess.check_output(cmd, shell=True, universal_newlines=True)
......@@ -74,6 +77,7 @@ def perform_flattening(tag):
cmd += ' --change "WORKDIR /openair-nrf" '
cmd += ' --change "EXPOSE 80/tcp" '
cmd += ' --change "EXPOSE 9090/tcp" '
cmd += ' --change "HEALTHCHECK --interval=10s --timeout=15s --retries=6 CMD /openair-nrf/bin/healthcheck.sh" '
cmd += ' --change "CMD [\\"/openair-nrf/bin/oai_nrf\\", \\"-c\\", \\"/openair-nrf/etc/nrf.conf\\", \\"-o\\"]" '
cmd += ' --change "ENTRYPOINT [\\"/bin/bash\\", \\"/openair-nrf/bin/entrypoint.sh\\"]" '
cmd += ' - ' + image_prefix + tag
......
......@@ -464,8 +464,6 @@ class HtmlReport():
section_end_pattern = 'build_nrf --clean --Verbose --build-type Release --jobs'
section_status = False
package_install = False
folly_build_start = False
folly_build_status = False
spdlog_build_start = False
spdlog_build_status = False
pistache_build_start = False
......@@ -501,12 +499,6 @@ class HtmlReport():
result = re.search('spdlog installation complete', line)
if result is not None and spdlog_build_start:
spdlog_build_status = True
result = re.search('Starting to install folly', line)
if result is not None:
folly_build_start = True
result = re.search('folly installation complete', line)
if result is not None and folly_build_start:
folly_build_status = True
result = re.search('Starting to install pistache', line)
if result is not None:
pistache_build_start = True
......@@ -554,12 +546,6 @@ class HtmlReport():
cell_msg += ' ** spdlog Installation: OK\n'
else:
cell_msg += ' ** spdlog Installation: KO\n'
if base_image:
cell_msg += ' ** folly Installation: N/A\n'
elif folly_build_status:
cell_msg += ' ** folly Installation: OK\n'
else:
cell_msg += ' ** folly Installation: KO\n'
if base_image:
cell_msg += ' ** pistache Installation: N/A\n'
elif pistache_build_status:
......@@ -573,9 +559,9 @@ class HtmlReport():
else:
cell_msg += ' ** Nlohmann Json Installation: KO\n'
if base_image:
cell_msg += ' ** nghttp2 Installation: N/A\n'
cell_msg += ' ** nghttp2-asio Installation: N/A\n'
elif nghttp2_build_status:
cell_msg += ' ** nghttp2 Installation: OK\n'
cell_msg += ' ** nghttp2-asio Installation: OK\n'
else:
cell_msg += ' ** nghttp2 Installation: KO\n'
if base_image:
......@@ -748,7 +734,7 @@ class HtmlReport():
if status and noPbInLDD:
cell_msg = ' <td bgcolor="LimeGreen"><pre style="border:none; background-color:LimeGreen"><b>'
cell_msg += 'OK:\n'
elif noPbInLDD:
elif not noPbInLDD:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
cell_msg += 'KO:\n'
cell_msg += ' Some libraries were not copied from builder image\n'
......
......@@ -21,7 +21,7 @@
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface NRF service
# Valid for RHEL 8.2
# Valid for UBI 8.6 | RHEL 8.6
#
#---------------------------------------------------------------------
......@@ -31,8 +31,6 @@
FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-nrf-builder
ARG NEEDED_GIT_PROXY
# Copy the entitlements
COPY ./etc-pki-entitlement /etc/pki/entitlement
......@@ -54,7 +52,6 @@ RUN rm -f /etc/rhsm-host && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
......@@ -66,46 +63,56 @@ COPY . /openair-nrf
WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --install-deps --force
RUN ./build_nrf --clean --Verbose --build-type Release --jobs && \
ldd /openair-nrf/build/nrf/build/nrf && \
mv /openair-nrf/build/nrf/build/nrf /openair-nrf/build/nrf/build/oai_nrf && \
rm /etc/pki/entitlement/*pem
# Remove entitlements and Subscription Manager configs
rm -rf /etc/pki/entitlement && \
rm -rf /etc/rhsm
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-nrf
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest as oai-nrf
ENV TZ=Europe/Paris
# Copy the entitlements
COPY ./etc-pki-entitlement /etc/pki/entitlement
# Copy the subscription manager configurations
COPY ./rhsm-conf /etc/rhsm
COPY ./rhsm-ca /etc/rhsm/ca
# We install some debug tools for the moment in addition of mandatory libraries
RUN yum update -y && \
yum install -y --enablerepo="ubi-8-codeready-builder" \
RUN rm -f /etc/rhsm-host && \
microdnf update -y && \
microdnf install -y \
tzdata \
libasan \
procps-ng \
psmisc \
net-tools \
procps-ng\
libevent && \
yum clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf
libicu \
boost \
libevent \
findutils \
libconfig && \
microdnf clean all -y && \
rm -rf /var/cache/yum /var/cache/dnf && \
# Remove entitlements and Subscription Manager configs
rm -rf /etc/pki/entitlement && \
rm -rf /etc/rhsm
# Copying executable and generated libraries
WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder \
/openair-nrf/build/nrf/build/oai_nrf \
/openair-nrf/scripts/entrypoint.sh \
/openair-nrf/scripts/healthcheck.sh \
./
COPY --from=oai-nrf-builder \
# Copying only the packages built from source
/usr/local/lib64/libpistache.so.0 \
/usr/local/lib/libnghttp2_asio.so \
/usr/lib64/libgflags.so.2.1 \
/usr/lib64/libglog.so.0 \
/usr/lib64/libdouble-conversion.so.1 \
/usr/lib64/libconfig++.so.9 \
/usr/lib64/libboost_system.so.1.66.0 \
/usr/lib64/libboost_thread.so.1.66.0 \
/usr/lib64/libboost_filesystem.so.1.66.0 \
/usr/lib64/libboost_chrono.so.1.66.0 \
/usr/lib64/libboost_atomic.so.1.66.0 \
/usr/lib64/libboost_date_time.so.1.66.0 \
/usr/lib64/libboost_regex.so.1.66.0 \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib64/
RUN ldconfig && \
......@@ -120,6 +127,11 @@ WORKDIR /openair-nrf
# expose ports
EXPOSE 80/tcp 9090/tcp
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-nrf/bin/healthcheck.sh
ENTRYPOINT ["/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
......@@ -21,17 +21,18 @@
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface NRF service
# Valid for Ubuntu-18.04 (bionic)
# Valid for Ubuntu-18.04 (bionic),
# Ubuntu-20.04 (focal),
# Ubuntu-22.04 (jammy)
# The port exposed by container are 8080/tcp , 9090/tcp change it according to your setup
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
# BASE IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-nrf-builder
ARG NEEDED_GIT_PROXY
ARG BASE_IMAGE=ubuntu:bionic
FROM $BASE_IMAGE as oai-nrf-base
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
......@@ -42,7 +43,6 @@ RUN apt-get update && \
&& rm -rf /var/lib/apt/lists/*
# Some GIT configuration command quite useful
RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.proxy $NEEDED_GIT_PROXY; fi"
RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
......@@ -50,20 +50,28 @@ RUN git config --global https.postBuffer 123289600 && \
COPY . /openair-nrf
WORKDIR /openair-nrf
# Installing and Building NRF
# Installing all the needed libraries/packages to build and run NRF
WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --install-deps --force && \
cp -Rf /openair-nrf/build/ext /openair-nrf-ext-ref
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM oai-nrf-base as oai-nrf-builder
# Building NRF
WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --install-deps --force
RUN ./build_nrf --clean --Verbose --build-type Release --jobs && \
RUN ldconfig && \
./build_nrf --clean --Verbose --build-type Release --jobs && \
ldd /openair-nrf/build/nrf/build/nrf && \
mv /openair-nrf/build/nrf/build/nrf /openair-nrf/build/nrf/build/oai_nrf
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-nrf
FROM $BASE_IMAGE as oai-nrf
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
......@@ -73,30 +81,44 @@ RUN apt-get update && \
iputils-ping \
bc \
tzdata \
libasan4 \
libgoogle-glog0v5 \
libdouble-conversion1 \
# Ubuntu 18 --> libasan4
# Ubuntu 20 --> libasan5
# Ubuntu 22 --> libasan6
libasan? \
libconfig++9v5 \
libldap-2.4-2 \
# Ubuntu 18/20 --> libldap-2.4-2
# Ubuntu 22 --> libldap-2.5-0
libldap-2.?-? \
libkrb5-3 \
libgssapi-krb5-2 \
libcurl4-gnutls-dev \
librtmp1 \
libpsl5 \
&& rm -rf /var/lib/apt/lists/*
# Ubuntu 18 --> boost62/65 -> will remove both
# Ubuntu 20 --> boost67/71 -> will remove 67
# Ubuntu 22 --> boost74
libboost-thread1.??.0 \
libboost-chrono1.??.0 \
&& rm -rf /var/lib/apt/lists/* \
/lib/x86_64-linux-gnu/libboost_system.so.1.6*.0 \
/lib/x86_64-linux-gnu/libboost_chrono.so.1.6*.0 \
/lib/x86_64-linux-gnu/libboost_thread.so.1.6*.0
# Copying executable and generated libraries
WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder \
/openair-nrf/build/nrf/build/oai_nrf \
/openair-nrf/scripts/entrypoint.sh \
/openair-nrf/scripts/healthcheck.sh \
./
COPY --from=oai-nrf-builder \
/usr/local/lib/libpistache.so \
# Copying only the packages built from source
/usr/local/lib/libnghttp2.so.14 \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4 \
/usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 \
/usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 \
/usr/local/lib/libpistache.so \
# Ubuntu 18 --> boost 67 will be copied
/usr/lib/libboost_system.so.1.* \
/usr/lib/libboost_thread.so.1.* \
/usr/local/lib/
RUN ldconfig && \
......@@ -109,6 +131,11 @@ WORKDIR /openair-nrf
# expose ports
EXPOSE 80/tcp 9090/tcp
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-nrf/bin/healthcheck.sh
ENTRYPOINT ["/bin/bash","/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
#!/bin/bash
set -eo pipefail
STATUS=0
NRF_IP_SBI_INTERFACE=$(ifconfig $NRF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'})
NRF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$NRF_IP_SBI_INTERFACE:$NRF_INTERFACE_PORT_FOR_SBI")
#Check if entrypoint properly configured the conf file and no parameter is unset(optional)
NB_UNREPLACED_AT=`cat /openair-nrf/etc/*.conf | grep -v contact@openairinterface.org | grep -c @ || true`
if [ $NB_UNREPLACED_AT -ne 0 ]; then
STATUS=1
echo "Healthcheck error: UNHEALTHY configuration file is not configured properly"
fi
if [[ -z $NRF_SBI_PORT_STATUS ]]; then
STATUS=1
echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $NRF_INTERFACE_PORT_FOR_SBI is not listening."
fi
exit $STATUS
\ No newline at end of file
......@@ -52,6 +52,7 @@
using namespace oai::nrf::app;
using namespace oai::nrf::model;
using namespace std::chrono;
using namespace boost::placeholders;
extern nrf_app* nrf_app_inst;
extern nrf_config nrf_cfg;
......
......@@ -43,6 +43,7 @@
using namespace Pistache::Http;
using namespace Pistache::Http::Mime;
using namespace oai::nrf::app;
using namespace boost::placeholders;
using json = nlohmann::json;
extern nrf_client* nrf_client_inst;
......
......@@ -39,6 +39,7 @@
using namespace std;
using namespace oai::nrf::app;
using namespace boost::placeholders;
//------------------------------------------------------------------------------
void nrf_profile::set_nf_instance_id(const std::string& instance_id) {
......@@ -1777,4 +1778,4 @@ void pcf_profile::to_json(nlohmann::json& data) const {
for (auto dnn : pcf_info.dnn_list) {
data["pcfInfo"]["dnnList"].push_back(dnn);
}
}
\ No newline at end of file
}
......@@ -35,6 +35,7 @@
#include "logger.hpp"
using namespace oai::nrf::app;
using namespace boost::placeholders;
//------------------------------------------------------------------------------
void nrf_subscription::set_subscription_id(const std::string& sub) {
......
......@@ -291,5 +291,4 @@ IF(STATIC_LINKING)
ENDIF(STATIC_LINKING)
target_link_libraries (nrf ${ASAN}
-Wl,--start-group NRF 3GPP_COMMON_TYPES NRF_API CN_UTILS -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} -lnghttp2_asio -lboost_system -lboost_thread -lboost_date_time -lssl -lcrypto gflags glog dl double-conversion folly -Wl,--end-group pthread m rt config++ event boost_system pistache curl)
\ No newline at end of file
-Wl,--start-group NRF 3GPP_COMMON_TYPES NRF_API CN_UTILS -lnettle ${NETTLE_LIBRARIES} ${CRYPTO_LIBRARIES} -lnghttp2_asio -lboost_system -lboost_thread -lboost_date_time -lssl -lcrypto dl -Wl,--end-group pthread m rt config++ event boost_system pistache curl)
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment