Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ git clone http://github.com/OPENAIRINTERFACE/openair-k8s
cd openair-k8s
```

#### Ubuntu

Follow this [guide](https://computingforgeeks.com/how-to-install-podman-on-ubuntu/) to install `podman`.

### Building
To build all OAI component images:
```sh
Expand Down
72 changes: 60 additions & 12 deletions hack/build_images
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
#!/bin/bash

source /etc/os-release
PLATFORM=${PLATFORM:-${ID#rh*}${VERSION_ID%.*}}
if [[ -f /etc/os-release ]]; then
source /etc/os-release
PLATFORM=${PLATFORM:-${ID#rh*}${VERSION_ID%.*}}
fi

if [[ ${PLATFORM} == "rh"* ]]; then
DOCKERFILE_SUFIX=rh${PLATFORM}
else
PLATFORM="centos8"
DOCKERFILE_SUFIX=${PLATFORM}
fi

if hash podman 2>/dev/null; then
USE_PODMAN=true
fi

KERNEL_VERSION=${KERNEL_VERSION:-$(uname -r)}
KERNEL_VERSION=${KERNEL_VERSION%*.x86_64}
REGISTRY=${REGISTRY:-registry.redhat.io}
Expand All @@ -26,16 +40,16 @@ available images:
exit 1
}

build_image() {
build_image_podman() {
local IMAGE=$1
local TAG=$2
local CLEAN_TAG=$(echo $TAG | sed -r 's/^v([0-9])/\1/')

local CLEAN_TAG=$(echo $TAG | sed 's/^v\([0-9]\)/\1/')
echo "Building images using - Podman"
# Default to building from Dockerfile. If there's a platform-specific Dockerfile
# use that instead and append the platform name to the image tag.
DOCKERFILE="Dockerfile"
if [ -f images/$IMAGE/Dockerfile.rh${PLATFORM} ]; then
DOCKERFILE="Dockerfile.rh${PLATFORM}"
if [ -f images/$IMAGE/Dockerfile.${DOCKERFILE_SUFIX} ]; then
DOCKERFILE="Dockerfile.${DOCKERFILE_SUFIX}"
CLEAN_TAG="${CLEAN_TAG}.${PLATFORM}"
fi

Expand All @@ -56,6 +70,33 @@ build_image() {
fi
}

build_image_docker() {
local IMAGE=$1
local TAG=$2
local CLEAN_TAG=$(echo $TAG | sed 's/^v\([0-9]\)/\1/')

echo "Building images using - Docker"
# Default to building from Dockerfile. If there's a platform-specific Dockerfile
# use that instead and append the platform name to the image tag.
DOCKERFILE="Dockerfile"
if [ -f images/$IMAGE/Dockerfile.${DOCKERFILE_SUFIX} ]; then
DOCKERFILE="Dockerfile.${DOCKERFILE_SUFIX}"
CLEAN_TAG="${CLEAN_TAG}.${PLATFORM}"
fi

info "Building image $IMAGE:$CLEAN_TAG"

docker build \
--network=host \
$BUILD_ARGS \
--build-arg GIT_TAG=$TAG \
--build-arg KERNEL_VERSION=$KERNEL_VERSION \
--build-arg EURECOM_PROXY=$PROXY \
-f images/$IMAGE/$DOCKERFILE \
-t $IMAGE:$CLEAN_TAG \
images/$IMAGE
}

# parse command line args
POSITIONAL=()
while [[ $# -gt 0 ]]; do
Expand All @@ -81,7 +122,9 @@ if [ $# -ne 0 ]; then
IMAGES=$*
fi

podman login ${REGISTRY}
if [[ ${PLATFORM} == "rh"* ]]; then
podman login ${REGISTRY}
fi

IMAGES="oai-build-base ${IMAGES/oai-build-base/}"

Expand All @@ -92,11 +135,16 @@ for i in $IMAGES; do
TAG=${i#*:}
# if no git_tag specified, grep default from Dockerfile
if [ "$IMG" = "$TAG" ]; then
if [ -f images/$IMG/Dockerfile.rh${PLATFORM} ]; then
TAG=$(grep -oP "ARG GIT_TAG=\K[a-zA-Z0-9.-]+" images/$IMG/Dockerfile.rh${PLATFORM} || echo "latest")
if [ -f images/$IMG/Dockerfile.${DOCKERFILE_SUFIX} ]; then
TAG=$(sed -n "s/ARG GIT_TAG=\(.*\)/\1/p" images/$IMG/Dockerfile.${DOCKERFILE_SUFIX} || echo "latest")
else
TAG=$(grep -oP "ARG GIT_TAG=\K[a-zA-Z0-9.-]+" images/$IMG/Dockerfile || echo "latest")
TAG=$(sed -n "s/ARG GIT_TAG=\(.*\)/\1/p" images/$IMG/Dockerfile || echo "latest")
fi
fi
build_image $IMG $TAG
# decide whether or not to use docker or podman
if [[ -z $USE_PODMAN ]]; then
build_image_docker $IMG $TAG
else
build_image_podman $IMG $TAG
fi
done
91 changes: 91 additions & 0 deletions images/oai-build-base/Dockerfile.centos8
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
# Copyright 2020 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# 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.

FROM centos:8

ARG GIT_TAG=latest
LABEL name="oai-build-base" \
version="${GIT_TAG}.centos8" \
io.k8s.description="Image containing all build dependencies for openairinterface5g and openair-cn."

WORKDIR /root
RUN yum -y install --enablerepo="PowerTools" \
git make cmake gcc gcc-c++ autoconf automake bc bison flex libtool patch \
atlas-devel \
blas \
blas-devel \
boost \
boost-devel \
bzip2-devel \
check \
check-devel \
diffutils \
elfutils-libelf-devel \
file \
gflags-devel \
glog-devel \
gmp-devel \
gnutls-devel \
guile-devel \
kernel-devel \
kernel-headers \
lapack \
lapack-devel \
libasan \
libconfig-devel \
libevent-devel \
libffi-devel \
libgcrypt-devel \
libidn-devel \
libidn2-devel \
libtool \
libusb-devel \
libusbx-devel \
libxml2-devel \
libXpm-devel \
libxslt-devel \
libyaml-devel \
lksctp-tools \
lksctp-tools-devel \
lz4-devel \
mariadb-devel \
nettle-devel \
numactl-devel \
openssh-clients \
openssh-server \
openssl \
openssl-devel \
pkgconfig \
protobuf \
protobuf-c \
protobuf-c-compiler \
protobuf-c-devel \
psmisc \
python2 \
python2-docutils \
python2-requests \
vim-common \
xz-devel \
zlib-devel \
&& yum install -y http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/x/xforms-1.2.4-5.el7.x86_64.rpm \
&& yum install -y http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/x/xforms-devel-1.2.4-5.el7.x86_64.rpm \
&& yum clean all -y \
&& rm -rf /var/cache/yum \
&& pip2 install --user mako pexpect

# build packages not present in CentOS/EPEL repos
COPY patches patches/
COPY scripts scripts/
RUN scripts/build_missing_packages
81 changes: 81 additions & 0 deletions images/oai-enb/Dockerfile.centos8
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
# Copyright 2020 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# 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.

FROM oai-build-base:latest.centos8 AS builder

ARG GIT_TAG=v1.1.1

WORKDIR /root

RUN if [ "$EURECOM_PROXY" == true ]; then git config --global http.proxy http://:@proxy.eurecom.fr:8080; fi

RUN git clone --depth=1 --branch=$GIT_TAG https://gitlab.eurecom.fr/oai/openairinterface5g.git
COPY patches patches/
RUN patch -p1 -d openairinterface5g < patches/disable_building_nasmesh_and_rbtool.patch \
&& patch -p1 -d openairinterface5g < patches/disable_sched_fifo_fail_exits.patch
RUN cd openairinterface5g/cmake_targets \
&& ln -sf /usr/local/bin/asn1c_oai /usr/local/bin/asn1c \
&& ln -sf /usr/local/share/asn1c_oai /usr/local/share/asn1c \
&& ./build_oai -c --eNB -w USRP --verbose-compile


FROM centos:8
LABEL name="oai-enb" \
version="$GIT_TAG" \
io.k8s.description="openairinterface5g eNB $GIT_TAG."

RUN REPOLIST="PowerTools" \
PKGLIST="boost libconfig lksctp-tools protobuf-c iproute iputils procps-ng bind-utils" \
# && yum -y upgrade-minimal --setopt=tsflags=nodocs --security --sec-severity=Critical --sec-severity=Important && \
&& yum -y install --enablerepo ${REPOLIST} --setopt=tsflag=nodocs ${PKGLIST} \
&& yum -y install http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/x/xforms-1.2.4-5.el7.x86_64.rpm \
&& yum -y clean all \
&& rm -rf /var/cache/yum

ENV APP_ROOT=/opt/oai-enb
ENV PATH=${APP_ROOT}:${PATH} HOME=${APP_ROOT}
COPY --from=builder /root/openairinterface5g/cmake_targets/lte_build_oai/build/lte-softmodem ${APP_ROOT}/bin/
COPY --from=builder /root/openairinterface5g/cmake_targets/lte_build_oai/build/*.so* /lib64/
COPY --from=builder /usr/local/lib64 /lib64/
COPY --from=builder /usr/local/bin/uhd_* /usr/local/bin/
COPY --from=builder /usr/local/share/uhd /usr/local/share/uhd/
RUN cd /lib64 \
&& ln -sf liboai_eth_transpro.so liboai_transpro.so \
&& ln -sf liboai_usrpdevif.so liboai_device.so \
&& ln -sf libuhd.so.3.13 libuhd.so.3 \
&& ln -sf libuhd.so.3 libuhd.so
COPY scripts ${APP_ROOT}/bin/
COPY configs ${APP_ROOT}/etc/
RUN chmod -R u+x ${APP_ROOT} && \
chgrp -R 0 ${APP_ROOT} && \
chmod -R g=u ${APP_ROOT} /etc/passwd
USER 10001
WORKDIR ${APP_ROOT}

# S1U, GTP/UDP
EXPOSE 2152/udp
# ?
EXPOSE 22100/tcp
# S1C, SCTP/UDP
EXPOSE 36412/udp
# X2C, SCTP/UDP
EXPOSE 36422/udp
# IF5 / ORI (control)
EXPOSE 50000/udp
# IF5 / ECPRI (data)
EXPOSE 50001/udp

CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"]
ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
80 changes: 80 additions & 0 deletions images/oai-gnb/Dockerfile.centos8
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
# Copyright 2020 VMware, Inc.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
#
# 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.

FROM oai-build-base:latest.centos8 AS builder

ARG GIT_TAG=develop-nr

WORKDIR /root

RUN if [ "$EURECOM_PROXY" == true ]; then git config --global http.proxy http://:@proxy.eurecom.fr:8080; fi

RUN git clone --depth=1 --branch=$GIT_TAG https://gitlab.eurecom.fr/oai/openairinterface5g.git
COPY patches patches/
RUN patch -p1 -d openairinterface5g < patches/disable_building_nasmesh_rbtools_ue_ip.patch
RUN cd openairinterface5g/cmake_targets \
&& ln -sf /usr/local/bin/asn1c_oai /usr/local/bin/asn1c \
&& ln -sf /usr/local/share/asn1c_oai /usr/local/share/asn1c \
&& ./build_oai --gNB -w USRP --verbose-compile


FROM centos:8
LABEL name="oai-gnb" \
version="$GIT_TAG" \
io.k8s.description="openairinterface5g gNB $GIT_TAG."

RUN REPOLIST="PowerTools" \
&& PKGLIST="atlas blas boost lapack libconfig libusb libusbx lksctp-tools protobuf-c iproute iputils procps-ng bind-utils" \
# && yum -y upgrade-minimal --setopt=tsflags=nodocs --security --sec-severity=Critical --sec-severity=Important \
&& yum -y install --enablerepo ${REPOLIST} --setopt=tsflag=nodocs ${PKGLIST} \
&& yum install -y http://download-ib01.fedoraproject.org/pub/epel/7/x86_64/Packages/x/xforms-1.2.4-5.el7.x86_64.rpm \
&& yum -y clean all \
&& rm -rf /var/cache/yum

ENV APP_ROOT=/opt/oai-gnb
ENV PATH=${APP_ROOT}:${PATH} HOME=${APP_ROOT}
COPY --from=builder /root/openairinterface5g/cmake_targets/ran_build/build/nr-softmodem ${APP_ROOT}/bin/
COPY --from=builder /root/openairinterface5g/cmake_targets/ran_build/build/*.so* /lib64/
COPY --from=builder /usr/local/lib64 /lib64/
COPY --from=builder /usr/local/bin/uhd_* /usr/local/bin/
COPY --from=builder /usr/local/share/uhd /usr/local/share/uhd/
RUN cd /lib64 \
&& ln -sf liboai_eth_transpro.so liboai_transpro.so \
&& ln -sf liboai_usrpdevif.so liboai_device.so \
&& ln -sf libuhd.so.3.13 libuhd.so.3 \
&& ln -sf libuhd.so.3 libuhd.so
COPY scripts ${APP_ROOT}/bin/
COPY configs ${APP_ROOT}/etc/
RUN chmod -R u+x ${APP_ROOT} && \
chgrp -R 0 ${APP_ROOT} && \
chmod -R g=u ${APP_ROOT} /etc/passwd
USER 10001
WORKDIR ${APP_ROOT}

# S1U, GTP/UDP
EXPOSE 2152/udp
# ?
EXPOSE 22100/tcp
# S1C, SCTP/UDP
EXPOSE 36412/udp
# X2C, SCTP/UDP
EXPOSE 36422/udp
# IF5 / ORI (control)
EXPOSE 50000/udp
# IF5 / ECPRI (data)
EXPOSE 50001/udp

CMD ["/opt/oai-gnb/bin/nr-softmodem", "-O", "/opt/oai-gnb/etc/gnb.conf"]
ENTRYPOINT ["/opt/oai-gnb/bin/entrypoint.sh"]
Loading