Commit d098fd63 authored by Raphael Defosseux's avatar Raphael Defosseux
Browse files

Merge branch 'dockerfile' into 'develop'

Rhel 8.2 support and tzdata

See merge request !2
parents d6293569 9c899ae9
Pipeline #23570 passed with stage
in 0 seconds
# RELEASE NOTES: #
<<<<<<< HEAD
## v1.0.0 -- Jan 2021 ##
=======
## vX.X.X -- YYY 2021 ##
>>>>>>> Initial Commit
* Initial release
......@@ -59,6 +59,7 @@ The OpenAirInterface CN NRF software is composed of the following parts:
<pre>
openair-cn5g-nrf
<<<<<<< HEAD
├── 3gpp-specs: Directory containing 3GPP specification files (YAML) used to implement NRF network function.
├── build: Build directory, contains targets and object files generated by compilation of network functions.
├── log: Directory containing build log files.
......@@ -74,4 +75,9 @@ openair-cn5g-nrf
├── oai_nrf: NRF main directory, contains the "main" CMakeLists.txt file.
├── nrf_app: NRF network functions procedures and contexts.
└── test: Directory containing some example profiles for e.g., AMF, SMF.
=======
├── ci-scripts: Directory containing the script files for CI framework.
└── src: Source files of NRF.
├── common: Common header files
>>>>>>> Initial Commit
</pre>
......@@ -25,21 +25,21 @@
#
#######################################
#SUPPORTED_DISTRO="Ubuntu 18.04, CentOS 7, RHEL 7"
SUPPORTED_DISTRO="Ubuntu 18.04"
SUPPORTED_DISTRO="Ubuntu 18.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="cmake" ;;
fedora) OS_BASEDISTRO="fedora"; INSTALLER="dnf"; CMAKE="cmake3" ;;
rhel) OS_BASEDISTRO="fedora"; INSTALLER="yum"; CMAKE="cmake3" ;;
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" ;;
esac
IS_CONTAINER=`egrep -c "docker|kubepods" /proc/self/cgroup`
IS_CONTAINER=`egrep -c "docker|kubepods|podman" /proc/self/cgroup`
if [ $IS_CONTAINER -eq 0 ]
then
......@@ -128,7 +128,10 @@ check_supported_distribution() {
local distribution=$(get_distribution_release)
case "$distribution" in
"ubuntu18.04") return 0 ;;
#"rhel7") return 0 ;;
"rhel8") return 0 ;;
"rhel8.2") return 0 ;;
"rhel8.3") return 0 ;;
"rhel8.4") return 0 ;;
#"centos7") return 0 ;;
esac
return 1
......
......@@ -47,32 +47,51 @@ install_fb_folly_from_source(){
if [[ $prompt =~ [yY](es)* ]]
then
$SUDO apt-get 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
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 apt-get install $OPTION \
$SUDO $INSTALLER install $OPTION \
libunwind8-dev \
libelf-dev \
libdwarf-dev
......@@ -82,7 +101,7 @@ install_fb_folly_from_source(){
tar zxf release-1.8.0.tar.gz && \
rm -f release-1.8.0.tar.gz && \
cd googletest-release-1.8.0 && \
cmake . && \
$CMAKE . && \
make && \
$SUDO make install
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......@@ -94,9 +113,32 @@ install_fb_folly_from_source(){
git clone https://github.com/facebook/folly.git
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
cd folly
git checkout -f v2019.11.11.00
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
cmake ..
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
......@@ -104,6 +146,7 @@ install_fb_folly_from_source(){
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo_success "End of folly installation"
return 0
}
......@@ -57,7 +57,7 @@ install_fmt() {
cd fmt
# Looks like since Nov 11 commits, we cannot build
git checkout -f 1936dddc3c53c1c0db55a665cf419dc7a257ba62
cmake -DFMT_TEST=FALSE .
$CMAKE -DFMT_TEST=FALSE .
ret=$?;[[ $ret -ne 0 ]] && return $ret
make -j `nproc`
ret=$?;[[ $ret -ne 0 ]] && return $ret
......@@ -140,7 +140,7 @@ 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 ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......@@ -188,7 +188,7 @@ install_nlohmann_from_git() {
cd json && git checkout master
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=OFF ..
$CMAKE -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=OFF ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......@@ -219,20 +219,39 @@ install_nghttp2_from_git() {
if [[ $prompt =~ [yY](es)* ]]
then
$SUDO apt-get install $OPTION \
g++ \
cmake \
binutils \
autoconf \
automake \
autotools-dev \
libtool \
pkg-config \
zlib1g-dev \
libcunit1-dev \
libssl-dev \
libxml2-dev libev-dev libevent-dev libjansson-dev libc-ares-dev \
libjemalloc-dev libsystemd-dev cython python3-dev python-setuptools
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
g++ \
cmake \
binutils \
autoconf \
automake \
autotools-dev \
libtool \
pkg-config \
zlib1g-dev \
libcunit1-dev \
libssl-dev \
libxml2-dev libev-dev libevent-dev libjansson-dev libc-ares-dev \
libjemalloc-dev libsystemd-dev cython python3-dev python-setuptools"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
gcc-c++ \
binutils-devel \
autoconf \
automake \
libtool \
pkg-config \
zlib-devel \
CUnit-devel \
openssl-devel \
libxml2-devel libev-devel libevent-devel jansson-devel c-ares-devel \
jemalloc-devel systemd-devel python3-Cython python3-devel python3-setuptools"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
fi
echo "Install build tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
GIT_URL=https://github.com/nghttp2/nghttp2.git
......@@ -288,19 +307,32 @@ install_cpp_jwt_from_git() {
if [[ $prompt =~ [yY](es)* ]]
then
$SUDO apt-get install $OPTION \
libgtest-dev \
libssl-dev
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
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
#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
......@@ -315,7 +347,7 @@ install_cpp_jwt_from_git() {
cd cpp-jwt && git checkout master
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
mkdir _build && cd _build
cmake ..
$CMAKE ..
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
make
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
......@@ -425,7 +457,6 @@ check_install_nrf_deps() {
libconfig-devel \
libgcrypt-devel \
gmp-devel \
libidn2-devel \
libidn-devel \
lksctp-tools \
lksctp-tools-devel \
......@@ -435,7 +466,9 @@ check_install_nrf_deps() {
libxml2-devel \
openssl \
check \
python \
nettle-devel \
libcurl-devel \
python2 \
pkgconfig"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
......
#/*
# * 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
# */
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface NRF service
# Valid for RHEL 8.2
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-nrf-builder
#Build inside cluster
COPY ./etc-pki-entitlement /etc/pki/entitlement
COPY ./rhsm-conf /etc/rhsm
COPY ./rhsm-ca /etc/rhsm/ca
# Build outside cluster
#COPY tmp/ca/redhat-uep.pem /etc/rhsm/ca
#COPY tmp/entitlement/*.pem /etc/pki/entitlement
RUN rm -f /etc/rhsm-host && \
yum repolist --disablerepo=* && \
subscription-manager repos --enable codeready-builder-for-rhel-8-x86_64-rpms && \
yum update -y && \
yum install -y \
psmisc \
git \
diffutils \
libasan\
file && \
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
RUN git config --global http.sslverify false
# Copying source code
WORKDIR /openair-nrf
COPY . /openair-nrf
# Installing and Building nrf
WORKDIR /openair-nrf/build/scripts
RUN ./build_nrf --install-deps --force
RUN ./build_nrf --clean --Verbose --build-type Release --jobs
RUN rm /etc/pki/entitlement/*pem
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-nrf
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 \
net-tools \
procps-ng\
libevent && \
rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder /openair-nrf/build/nrf/build/nrf oai_nrf
COPY --from=oai-nrf-builder /usr/local/lib64/libpistache.so.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/local/lib/libnghttp2_asio.so /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libgflags.so.2.1 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libglog.so.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libdouble-conversion.so.1 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libconfig++.so.9 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_system.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_thread.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_filesystem.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_chrono.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_atomic.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_date_time.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /usr/lib64/libboost_regex.so.1.66.0 /usr/lib64/
COPY --from=oai-nrf-builder /openair-nrf/scripts/entrypoint.sh entrypoint.sh
RUN ldconfig
# Copying template configuration files
# The configuration folder will be flat
WORKDIR /openair-nrf/etc
COPY --from=oai-nrf-builder /openair-nrf/etc/nrf.conf .
WORKDIR /openair-nrf
# expose ports
EXPOSE 80/tcp 9090/tcp
ENTRYPOINT ["/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
......@@ -14,8 +14,6 @@ FROM ubuntu:bionic as oai-nrf-builder
ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
git \
......@@ -40,14 +38,15 @@ RUN ./build_nrf --clean --Verbose --build-type Release --jobs
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-nrf
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
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 && DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
iputils-ping \
bc \
tzdata \
tshark \
libasan4 \
libgoogle-glog0v5 \
......@@ -59,24 +58,21 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && DE
# Copying executable and generated libraries
WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder /openair-nrf/build/nrf/build/nrf oai_nrf
COPY --from=oai-nrf-builder /openair-nrf/scripts/entrypoint.sh entrypoint.sh
COPY --from=oai-nrf-builder /usr/local/lib/libpistache.so /usr/local/lib/
COPY --from=oai-nrf-builder /usr/local/lib/libnghttp2_asio.so.1 /usr/local/lib/
COPY --from=oai-nrf-builder /usr/lib/x86_64-linux-gnu/libboost_system.so.1.65.1 /usr/lib/x86_64-linux-gnu/
COPY --from=oai-nrf-builder /usr/lib/x86_64-linux-gnu/libboost_thread.so.1.65.1 /usr/lib/x86_64-linux-gnu/
COPY --from=oai-nrf-builder /openair-nrf/docker/entrypoint.sh entrypoint.sh
RUN ldconfig
# Copying template configuration files
WORKDIR /openair-nrf/etc
COPY --from=oai-nrf-builder /openair-nrf/etc/nrf.conf /openair-nrf/etc/
WORKDIR /openair-nrf
EXPOSE 8080/tcp 9090/tcp
# expose ports
EXPOSE 80/tcp 9090/tcp
# Temporary can be removed but in some-scenarioes it is safe to keep it.
RUN chmod +x /openair-nrf/bin/entrypoint.sh
ENTRYPOINT ["/bin/bash","/openair-nrf/bin/entrypoint.sh"]
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
ENTRYPOINT ["/bin/bash","/openair-nrf/bin/entrypoint.sh"]
version: '3'
services:
oai_nrf:
container_name: "oai_nrf"
image: oai-nrf:1.0
ports:
- 8080:8080
- 9092:9092
environment:
- NRF_INTERFACE_NAME_FOR_SBI=eth0
- NRF_INTERFACE_PORT_FOR_SBI=8080
- NRF_INTERFACE_HTTP2_PORT_FOR_SBI=9090
- NRF_API_VERSION=v1
- INSTANCE=0
- PID_DIRECTORY=/var/run
networks:
default:
driver: bridge
ipam:
config:
- subnet: 172.18.59.0/24
#---------------------------------------------------------------------
#
# Docker entrypoint file for setting up environment variables and generating conf file
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#!/bin/bash
set -euo pipefail
......@@ -12,13 +6,13 @@ CONFIG_DIR="/openair-nrf/etc"
for c in ${CONFIG_DIR}/*.conf; do
# grep variable names (format: ${VAR}) from template to be rendered
VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
echo "Now setting these variables '${VARS}'"
# create sed expressions for substituting each occurrence of ${VAR}
# with the value of the environment variable "VAR"
EXPRESSIONS=""
for v in ${VARS}; do
NEW_VAR=`echo $v | sed -e "s#@##g"`
if [[ "${!NEW_VAR}x" == "x" ]]; then
if [[ -z ${!NEW_VAR+x} ]]; then
echo "Error: Environment variable '${NEW_VAR}' is not set." \
"Config file '$(basename $c)' requires all of $VARS."
exit 1
......@@ -30,6 +24,5 @@ for c in ${CONFIG_DIR}/*.conf; do
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
done
exec "$@"
echo "Done setting the configuration"
exec "$@"
\ No newline at end of file
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