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

fix(build): fix a few typos in build scripts, also added Dockerfiles for U18 and RHEL8


Signed-off-by: Raphael Defosseux's avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 31934ad5
......@@ -36,6 +36,7 @@ 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=""
......@@ -64,6 +65,7 @@ install_fmt() {
cd /tmp
rm -rf /tmp/fmt*
fi
echo "fmt installation complete"
return 0
}
......@@ -71,6 +73,7 @@ install_fmt() {
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_spdlog_from_git() {
echo "Starting to install spdlog"
if [ $1 -eq 0 ]; then
read -p "Do you want to install spdlog ? <y/N> " prompt
OPTION=""
......@@ -103,6 +106,7 @@ install_spdlog_from_git() {
sed -i '/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g' include/spdlog/tweakme.h
popd
fi
echo "spdlog installation complete"
return 0
}
......@@ -110,6 +114,7 @@ install_spdlog_from_git() {
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_pistache_from_git() {
echo "Starting to install pistache"
if [ $1 -eq 0 ]; then
read -p "Do you want to install Pistache ? <y/N> " prompt
OPTION="-y"
......@@ -152,6 +157,7 @@ install_pistache_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo "pistache installation complete"
return 0
}
......@@ -159,9 +165,10 @@ install_pistache_from_git() {
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_nlohmann_from_git() {
echo "Starting to install Nlohmann Json"
if [ $1 -eq 0 ]; then
read -p "Do you want to install Nlohmann Json ? <y/N> " prompt
OPTION="-y"
OPTION=""
else
prompt='y'
OPTION="-y"
......@@ -197,6 +204,7 @@ install_nlohmann_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo "Nlohmann Json installation complete"
return 0
}
......@@ -204,6 +212,7 @@ install_nlohmann_from_git() {
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
install_nghttp2_from_git() {
echo "Starting to install nghttp2"
if [ $1 -eq 0 ]; then
read -p "Do you want to install nghttp2 ? <y/N> " prompt
OPTION=""
......@@ -223,7 +232,7 @@ install_nghttp2_from_git() {
if [[ $OS_DISTRO == "ubuntu" ]]; then
PACKAGE_LIST="\
g++ \
cmake \
$CMAKE \
binutils \
autoconf \
automake \
......@@ -285,6 +294,7 @@ install_nghttp2_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd
fi
echo "nghttp2 installation complete"
return 0
}
......@@ -329,7 +339,7 @@ check_install_udr_deps() {
automake \
bison \
build-essential \
cmake \
$CMAKE \
daemon \
doxygen \
flex \
......@@ -340,7 +350,9 @@ check_install_udr_deps() {
autoconf \
automake \
bison \
gcc-c++ \
$CMAKE \
make \
doxygen \
flex \
gdb \
......@@ -383,7 +395,7 @@ check_install_udr_deps() {
pkg-config \
mysql-server \
mysql-client \
libmysqlclient-dev \
libmysqlclient-dev \
libasan2"
elif [[ "$OS_BASEDISTRO" == "fedora" ]]; then
PACKAGE_LIST="\
......@@ -404,6 +416,9 @@ check_install_udr_deps() {
libcurl-devel \
python2 \
pkgconfig \
mysql \
mysql-devel \
mysql-libs \
libasan"
else
echo_fatal "$OS_DISTRO is not a supported distribution."
......@@ -411,6 +426,7 @@ check_install_udr_deps() {
echo "Install distro libs"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
echo "distro libs installation complete"
install_spdlog_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret
......@@ -425,6 +441,7 @@ check_install_udr_deps() {
$SUDO ldconfig
return 0
}
#-------------------------------------------------------------------------------
#arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries)
......@@ -518,8 +535,7 @@ check_install_udr_min_deps() {
echo "Install networking tools"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret
echo "networking tools installation complete"
return 0
}
#/*
# * 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 UDR service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM oai-udr-base:latest as oai-udr-builder
WORKDIR /openair-udr
COPY . /openair-udr
RUN cp -Rf /openair-udr-ext-ref /openair-udr/build/ext
# Building UDR
WORKDIR /openair-udr/build/scripts
RUN ./build_udr --clean --Verbose --build-type Release --jobs
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-udr
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 && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
tzdata \
bc \
tshark \
libmysqlclient20 \
libasan4 \
libpsl5 \
librtmp1 \
libldap-2.4-2 \
libnettle6 \
libnghttp2-14 \
libhogweed4 \
libconfig++9v5 && \
rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-udr/bin
COPY --from=oai-udr-builder /openair-udr/build/udr/build/udr oai_udr
COPY --from=oai-udr-builder /openair-udr/scripts/entrypoint.sh .
COPY --from=oai-udr-builder /usr/local/lib/libpistache.so /usr/local/lib/
RUN ldconfig
WORKDIR /openair-udr/etc
COPY --from=oai-udr-builder /openair-udr/etc/udr.conf .
WORKDIR /openair-udr
EXPOSE 80/tcp
ENTRYPOINT ["/bin/bash","/openair-udr/bin/entrypoint.sh"]
CMD ["/openair-udr/bin/oai_udr", "-c" , "/openair-udr/etc/udr.conf", "-o"]
#/*
# * 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 UDR service
# Valid for RHEL 8.2
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest AS oai-udr-builder
ARG NEEDED_GIT_PROXY
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 \
file \
gcc-c++ \
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" && \
git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
# Copying source code
WORKDIR /openair-udr
COPY . /openair-udr
# Installing and Building UDR
WORKDIR /openair-udr/build/scripts
RUN ./build_udr --install-deps --force
# Patching the CMakefile to link mysqlclient
RUN sed -i -e "s@-lmysqlclient@-L/usr/lib64/mysql -lmysqlclient@" ../../src/oai_udr/CMakeLists.txt && \
./build_udr --clean --Verbose --build-type Release --jobs
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi8/ubi:latest as oai-udr
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" \
tzdata \
procps-ng \
psmisc \
net-tools \
nettle \
libubsan \
libasan \
liblsan \
libevent && \
yum clean all -y && \
rm -rf /var/cache/yum && \
echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
# Copying executable and generated libraries
WORKDIR /openair-udr/bin
COPY --from=oai-udr-builder /openair-udr/build/udr/build/udr oai_udr
COPY --from=oai-udr-builder /openair-udr/scripts/entrypoint.sh .
WORKDIR /usr/local/lib64
COPY --from=oai-udr-builder /usr/local/lib64/libpistache.so.0 .
COPY --from=oai-udr-builder /lib64/libboost_system.so.1.66.0 .
COPY --from=oai-udr-builder /lib64/libboost_thread.so.1.66.0 .
COPY --from=oai-udr-builder /lib64/libboost_date_time.so.1.66.0 .
COPY --from=oai-udr-builder /lib64/libconfig++.so.9 .
COPY --from=oai-udr-builder /lib64/libnghttp2.so.14 .
COPY --from=oai-udr-builder /usr/lib64/mysql/libmysqlclient.so.21 .
RUN ldconfig
WORKDIR /openair-udr/etc
COPY --from=oai-udr-builder /openair-udr/etc/udr.conf .
WORKDIR /openair-udr
EXPOSE 80/tcp
ENTRYPOINT ["/bin/bash","/openair-udr/bin/entrypoint.sh"]
CMD ["/openair-udr/bin/oai_udr", "-c" , "/openair-udr/etc/udr.conf", "-o"]
#/*
# * 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 UDR service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-udr-builder
ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get upgrade --yes && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
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" && \
git config --global https.postBuffer 123289600 && \
git config --global http.sslverify false
# Copying source code
WORKDIR /openair-udr
COPY . /openair-udr
# Installing and Building UDR
WORKDIR /openair-udr/build/scripts
RUN ./build_udr --install-deps --force
RUN ./build_udr --clean --Verbose --build-type Release --jobs
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-udr
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 && \
DEBIAN_FRONTEND=noninteractive apt-get install --yes \
psmisc \
net-tools \
tzdata \
bc \
tshark \
libmysqlclient20 \
libasan4 \
libpsl5 \
librtmp1 \
libldap-2.4-2 \
libnettle6 \
libnghttp2-14 \
libhogweed4 \
libconfig++9v5 && \
rm -rf /var/lib/apt/lists/*
# Copying executable and generated libraries
WORKDIR /openair-udr/bin
COPY --from=oai-udr-builder /openair-udr/build/udr/build/udr oai_udr
COPY --from=oai-udr-builder /openair-udr/scripts/entrypoint.sh .
COPY --from=oai-udr-builder /usr/local/lib/libpistache.so /usr/local/lib/
RUN ldconfig
WORKDIR /openair-udr/etc
COPY --from=oai-udr-builder /openair-udr/etc/udr.conf .
WORKDIR /openair-udr
EXPOSE 80/tcp
ENTRYPOINT ["/bin/bash","/openair-udr/bin/entrypoint.sh"]
CMD ["/openair-udr/bin/oai_udr", "-c" , "/openair-udr/etc/udr.conf", "-o"]
#!/bin/bash
set -euo pipefail
CONFIG_DIR="/openair-udm/etc"
UDR_INTERFACE_PORT_FOR_NUDR=${UDR_INTERFACE_PORT_FOR_NUDR:-80}
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)
# 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
echo "Error: Environment variable '${NEW_VAR}' is not set." \
"Config file '$(basename $c)' requires all of $VARS."
exit 1
fi
EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
done
EXPRESSIONS="${EXPRESSIONS#';'}"
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
done
exec "$@"
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