Skip to content
Snippets Groups Projects
Dockerfile.nrf.rocky9 4.17 KiB
Newer Older
#/*
# * 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
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------

FROM docker.io/rockylinux:9 AS oai-nrf-builder

ENV IS_DOCKERFILE=1

RUN dnf install 'dnf-command(config-manager)' -y && \
    dnf install epel-release -y && crb enable && \
    dnf update -y && \
    # here just to display the current version
    cat /etc/os-release && \
    dnf install -y \
      psmisc \
      git \
        diffutils \
        libasan \
        wget \
        file && \
    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 git config --global https.postBuffer 123289600 && \
    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 && \
    ldd /openair-nrf/build/nrf/build/nrf && \
    mv /openair-nrf/build/nrf/build/nrf /openair-nrf/build/nrf/build/oai_nrf

FROM mikefarah/yq:latest as yq-source

#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM docker.io/rockylinux:9-minimal as oai-nrf
ENV TZ=Europe/Paris

# We install some debug tools for the moment in addition of mandatory libraries
RUN microdnf update -y && \
    microdnf install -y \
# Debug Tools that are not mandatory
      tzdata \
      procps-ng \
      psmisc \
      net-tools \
      iputils \
      tcpdump \
# Mandatory packages for the NF to run
#      libasan \
      libicu \
      boost \
      libevent \
    microdnf clean all -y && \
    rm -rf /var/cache/yum /var/cache/dnf

# Copying executable and generated libraries
WORKDIR /openair-nrf/bin
COPY --from=oai-nrf-builder \
    /openair-nrf/build/nrf/build/oai_nrf \
    /openair-nrf/scripts/healthcheck.sh \
    ./
COPY --from=yq-source /usr/bin/yq /usr/bin

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/local/lib/libnghttp2_asio.so.1 \
    /usr/local/lib64/libyaml-cpp.so.0.* \
    /usr/local/lib64/libspdlog.so \
    /usr/local/lib64/libfmt.so \
    /usr/lib64/

RUN ldconfig && \
    ldd /openair-nrf/bin/oai_nrf

# Copying template configuration files
# The configuration folder will be flat
WORKDIR /openair-nrf/etc
COPY --from=oai-nrf-builder /openair-nrf/etc/config.yaml .

WORKDIR /openair-nrf

# expose ports
EXPOSE 80/tcp 8080/tcp
# healthcheck
HEALTHCHECK --interval=10s \
            --timeout=15s \
            --retries=6 \
    CMD /openair-nrf/bin/healthcheck.sh

CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/config.yaml", "-o"]