Commit 5d9612f9 authored by Raphael Defosseux's avatar Raphael Defosseux

fix(build): simplication and optimization of image building

  * Remove un-necessary builder image packages
  * Faster builds on built-from-source packages
  * Support for Ubuntu20/22 image generation
  * RHEL8-minimal target image
  * health-check natively in image
Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@openairinterface.org>
parent 5d3fd80b
......@@ -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" ;;
......@@ -129,6 +129,7 @@ check_supported_distribution() {
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 +165,10 @@ clean_kernel() {
#-------------------------------------------------------------------------------
disable_ipv6() {
if [ $IS_CONTAINER -eq 0 ]
then
$SUDO sysctl -w net.ipv6.conf.all.disable_ipv6=1
fi
}
......
......@@ -30,44 +30,6 @@
SCRIPT=$(readlink -f ${BASH_SOURCE})
THIS_SCRIPT_PATH=`dirname $SCRIPT`
source $THIS_SCRIPT_PATH/build_helper
source $THIS_SCRIPT_PATH/build_helper.libconfig
#-------------------------------------------------------------------------------
#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)
......@@ -150,11 +112,12 @@ install_pistache_from_git() {
-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
......@@ -201,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
......@@ -230,7 +194,7 @@ install_nghttp2_from_git() {
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
g++ \
cmake \
$CMAKE \
binutils \
autoconf \
automake \
......@@ -241,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++ \
......@@ -286,12 +250,13 @@ install_nghttp2_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
./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"
......@@ -324,8 +289,10 @@ check_install_smf_deps() {
#$SUDO systemctl mask apt-daily.timer
#$SUDO systemctl mask apt-daily-upgrade.service
#$SUDO systemctl mask apt-daily-upgrade.timer
if [ $IS_CONTAINER -eq 0 ]; then
$SUDO sed -i 's/1/0/g' /etc/apt/apt.conf.d/10periodic
fi
fi
update_package_db
......@@ -337,26 +304,16 @@ check_install_smf_deps() {
PACKAGE_LIST="\
autoconf \
automake \
bison \
build-essential \
cmake \
daemon \
doxygen \
flex \
gdb \
wget \
$CMAKE \
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."
......@@ -372,53 +329,48 @@ check_install_smf_deps() {
# 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 libboost-all-dev"
if [ $IS_CONTAINER -eq 0 ]; then
specific_packages="libconfig++-dev libasio-dev libboost-all-dev mysql-server libasan4"
else
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan4"
fi
;;
"ubuntu20.04")
specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
specific_packages="libconfig++-dev libasio-dev libboost-all-dev libasan5"
;;
*)
specific_packages="libconfig++-dev libasio-dev libboost-all-dev"
"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 \
libgcrypt?-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 \
wget \
libasan?"
ninja-build"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
boost-devel \
guile-devel \
libconfig-devel \
libgcrypt-devel \
gmp-devel \
libidn-devel \
lksctp-tools \
lksctp-tools-devel \
openssl-devel \
libnghttp2 \
libtool \
libxml2 \
libxml2-devel \
......@@ -428,6 +380,7 @@ check_install_smf_deps() {
libcurl-devel \
python2 \
pkgconfig \
ninja-build \
libasan"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
......@@ -440,6 +393,7 @@ check_install_smf_deps() {
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
......@@ -448,10 +402,6 @@ check_install_smf_deps() {
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
......@@ -464,6 +414,7 @@ check_install_smf_deps() {
install_nghttp2_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
$SUDO ldconfig
return 0
}
#-------------------------------------------------------------------------------
......@@ -563,5 +514,3 @@ check_install_smf_min_deps() {
return 0
}
......@@ -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-smf --tag oai-smf:' + smf_tag + ' --file docker/Dockerfile.smf.ubuntu18 . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
myShCmd('docker build --no-cache --target oai-smf --tag oai-smf:' + smf_tag + ' --file docker/Dockerfile.smf.ubuntu . > archives/smf_docker_image_build.log 2>&1', rem_u18_host_flag, rem_u18_host_user, rem_u18_host)
}
if ("MERGE".equals(env.gitlabActionType)) {
try {
......@@ -251,7 +251,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-smf --tag oai-smf:' + smf_tag + ' --file docker/Dockerfile.smf.rhel8 . > archives/smf_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-smf --tag oai-smf:' + smf_tag + ' --file docker/Dockerfile.smf.rhel8 --format docker . > archives/smf_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-smf:' + smf_tag, rem_rhel_host_flag, rem_rhel_host_user, rem_rhel_host)
......
......@@ -21,13 +21,16 @@
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface SMF service
# Valid for Ubuntu-18.04 (bionic)
# Valid for Ubuntu-18.04 (bionic),
# Ubuntu-20.04 (focal),
# Ubuntu-22.04 (jammy)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
ARG BASE_IMAGE=ubuntu:bionic
FROM oai-smf-base:latest as oai-smf-builder
WORKDIR /openair-smf/
......@@ -53,36 +56,53 @@ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
tzdata \
bc \
perl \
libssh-4 \
openssl \
libasan4 \
libbrotli1 \
netbase \
# Ubuntu 18 --> libasan4
# Ubuntu 20 --> libasan5
# Ubuntu 22 --> libasan6
libgssapi-krb5-2 \
# Ubuntu 18/20 --> libldap-2.4-2
# Ubuntu 22 --> libldap-2.5-0
libldap-2.?-? \
libconfig++9v5 \
libsctp1 \
librtmp1 \
libpsl5 \
libcurl?-gnutls \
libgssapi-krb5-2 \
libldap-2.4-2 \
libconfig++9v5 \
&& 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-smf/bin
COPY --from=oai-smf-builder \
/openair-smf/build/smf/build/oai_smf \
/openair-smf/scripts/entrypoint.sh \
/openair-smf/scripts/healthcheck.sh \
./
WORKDIR /usr/local/lib/
COPY --from=oai-smf-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/libboost_system.so.1.67.0 \
/usr/lib/libboost_thread.so.1.67.0 \
/usr/lib/libboost_chrono.so.1.67.0 \
/openair-smf/build/smf/build/nas/libNAS.so \
/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/lib/libboost_chrono.so.1.* \
./
RUN ldconfig && \
ldd /openair-smf/bin/oai_smf
......@@ -91,7 +111,14 @@ RUN ldconfig && \
WORKDIR /openair-smf/etc
COPY --from=oai-smf-builder /openair-smf/etc/smf.conf .
# expose ports
WORKDIR /openair-smf
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-smf/bin/healthcheck.sh
EXPOSE 80/tcp 9090/tcp 8805/udp
......
......@@ -568,11 +568,11 @@ 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'
cell_msg += ' ** nghttp2-asio Installation: KO\n'
cell_msg += '</b></pre></td>\n'
else:
cell_msg = ' <td bgcolor="Tomato"><pre style="border:none; background-color:Tomato"><b>'
......
......@@ -21,7 +21,7 @@
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface SMF service
# Valid for RHEL 8.2
# Valid for UBI 8.6 | RHEL 8.6
#
#---------------------------------------------------------------------
......@@ -30,8 +30,6 @@
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-smf-builder
ARG NEEDED_GIT_PROXY
# Copy the entitlements
COPY ./etc-pki-entitlement /etc/pki/entitlement
......@@ -48,11 +46,16 @@ RUN rm -f /etc/rhsm-host && \
git \
diffutils \
file \
boost-devel &&\
rm -rf /var/lib/apt/lists/*
gcc-c++ \
ninja-build \
boost-devel \
openssl-devel \
openssl \
libasan && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
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
......@@ -60,46 +63,64 @@ RUN git config --global https.postBuffer 123289600 && \
WORKDIR /openair-smf
COPY . /openair-smf
# Installing and Building SMF
# Installing all the needed libraries/packages to build and run SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
RUN ./build_smf --clean --Verbose --build-type Release --jobs && \
# Building SMF
WORKDIR /openair-smf/build/scripts
RUN ldconfig && \
./build_smf --clean --Verbose --build-type Release --jobs && \
ldd /openair-smf/build/smf/build/smf && \
mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf && \
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-smf
FROM registry.access.redhat.com/ubi8/ubi-minimal:latest as oai-smf
ENV TZ=Europe/Paris
# 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" \
psmisc \
# 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
RUN rm -f /etc/rhsm-host && \
microdnf update -y && \
microdnf install -y \
tzdata \
libasan \
procps-ng \
psmisc \
net-tools \
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-smf/bin
COPY --from=oai-smf-builder \
/openair-smf/build/smf/build/oai_smf \
/openair-smf/scripts/entrypoint.sh \
/openair-smf/scripts/healthcheck.sh \
./
COPY --from=oai-smf-builder \
/usr/local/lib64/libpistache.so.0 \
/usr/local/lib/libnghttp2_asio.so \
/usr/lib64/libconfig++.so.9 \
/usr/lib64/libboost_system.so.1.66.0 \
/usr/lib64/libboost_thread.so.1.66.0 \
/usr/lib64/libboost_chrono.so.1.66.0 \
/usr/local/lib/libnghttp2_asio.so.1 \
/usr/lib64/libasan.so.5 \
/openair-smf/build/smf/build/nas/libNAS.so \
/usr/lib64/
......@@ -115,6 +136,11 @@ WORKDIR /openair-smf
# expose ports
EXPOSE 80/tcp 9090/tcp 8805/udp
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-smf/bin/healthcheck.sh
ENTRYPOINT ["/openair-smf/bin/entrypoint.sh"]
CMD ["/openair-smf/bin/oai_smf", "-c", "/openair-smf/etc/smf.conf", "-o"]
......@@ -21,32 +21,28 @@
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface SMF service
# Valid for Ubuntu-18.04 (bionic)
# Valid for Ubuntu-18.04 (bionic),
# Ubuntu-20.04 (focal),
# Ubuntu-22.04 (jammy)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
# BASE IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf-builder
ARG NEEDED_GIT_PROXY
ARG BASE_IMAGE=ubuntu:bionic
FROM $BASE_IMAGE as oai-smf-base
ENV DEBIAN_FRONTEND=noninteractive
RUN echo "deb http://fr.archive.ubuntu.com/ubuntu bionic main restricted" >> /etc/apt/sources.list
ENV TZ=Europe/Paris
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
software-properties-common \
gnupg \
git && \
rm -rf /var/lib/apt/lists/*
git \
&& 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"
# Some GIT configuration commands quite useful
RUN git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
......@@ -54,17 +50,26 @@ RUN git config --global https.postBuffer 123289600 && \
WORKDIR /openair-smf
COPY . /openair-smf
# Installing and Building SMF
# Installing all the needed libraries/packages to build and run SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force && \
cp -Rf /openair-smf/build/ext /openair-smf-ext-ref
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM oai-smf-base as oai-smf-builder
# Building SMF
WORKDIR /openair-smf/build/scripts
RUN ./build_smf --install-deps --force
RUN ./build_smf --clean --Verbose --build-type Release --jobs && \
RUN ldconfig && \
./build_smf --clean --Verbose --build-type Release --jobs && \
ldd /openair-smf/build/smf/build/smf && \
mv /openair-smf/build/smf/build/smf /openair-smf/build/smf/build/oai_smf
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-smf
FROM $BASE_IMAGE as oai-smf
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe/Paris
# We install some debug tools for the moment in addition of mandatory libraries
......@@ -73,36 +78,53 @@ RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
tzdata \
bc \
perl \
libssh-4 \
openssl \
libasan4 \
libbrotli1 \
netbase \
# Ubuntu 18 --> libasan4
# Ubuntu 20 --> libasan5
# Ubuntu 22 --> libasan6
libgssapi-krb5-2 \
# Ubuntu 18/20 --> libldap-2.4-2
# Ubuntu 22 --> libldap-2.5-0
libldap-2.?-? \
libconfig++9v5 \
libsctp1 \
librtmp1 \
libpsl5 \
libcurl?-gnutls \
libgssapi-krb5-2 \
libldap-2.4-2 \
libconfig++9v5 \
&& 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-smf/bin
COPY --from=oai-smf-builder \
/openair-smf/build/smf/build/oai_smf \
/openair-smf/scripts/entrypoint.sh \
/openair-smf/scripts/healthcheck.sh \
./
WORKDIR /usr/local/lib/
COPY --from=oai-smf-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/libboost_system.so.1.67.0 \
/usr/lib/libboost_thread.so.1.67.0 \
/usr/lib/libboost_chrono.so.1.67.0 \
/openair-smf/build/smf/build/nas/libNAS.so \
/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/lib/libboost_chrono.so.1.* \
./
RUN ldconfig && \
ldd /openair-smf/bin/oai_smf
......@@ -111,7 +133,14 @@ RUN ldconfig && \
WORKDIR /openair-smf/etc
COPY --from=oai-smf-builder /openair-smf/etc/smf.conf .
# expose ports
WORKDIR /openair-smf
# healthcheck
HEALTHCHECK --interval=10s \
--timeout=15s \
--retries=6 \
CMD /openair-smf/bin/healthcheck.sh
EXPOSE 80/tcp 9090/tcp 8805/udp
......
#!/bin/bash
set -eo pipefail
STATUS=0
SMF_IP_SBI_INTERFACE=$(ifconfig $SMF_INTERFACE_NAME_FOR_SBI | grep inet | awk {'print $2'})
#Check if entrypoint properly configured the conf file and no parameter is unset(optional)
SMF_SBI_PORT_STATUS=$(netstat -tnpl | grep -o "$SMF_IP_SBI_INTERFACE:$SMF_INTERFACE_PORT_FOR_SBI")
NB_UNREPLACED_AT=`cat /openair-smf/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 $SMF_SBI_PORT_STATUS ]]; then
STATUS=-1
echo "Healthcheck error: UNHEALTHY SBI TCP/HTTP port $SMF_INTERFACE_PORT_FOR_SBI is not listening."
fi
exit $STATUS
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