Skip to content
Snippets Groups Projects
Dockerfile.pcf.rhel9 4.86 KiB
Newer Older
Rohan's avatar
Rohan committed
#/*
# * 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 PCF service
Rohan's avatar
Rohan committed
#
#---------------------------------------------------------------------

#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi9/ubi:latest AS oai-pcf-builder
Rohan's avatar
Rohan committed

ENV IS_DOCKERFILE=1

Rohan's avatar
Rohan committed
# 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 && \
    subscription-manager repos --enable codeready-builder-for-rhel-9-x86_64-rpms && \
    dnf update -y && \
    # here just to display the current version
    cat /etc/os-release && \
Rohan's avatar
Rohan committed
        psmisc \
        git \
        diffutils \
    echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && \
    echo "/usr/local/lib64" >> /etc/ld.so.conf.d/local-lib.conf
Rohan's avatar
Rohan committed

# Some GIT configuration command quite useful
RUN git config --global https.postBuffer 123289600 && \
    git config --global http.sslverify false
Rohan's avatar
Rohan committed

# Copying source code
WORKDIR /openair-pcf
COPY . /openair-pcf

# Installing and Building PCF
WORKDIR /openair-pcf/build/scripts
RUN ./build_pcf --install-deps --force
RUN ldconfig && \
    ./build_pcf --clean --Verbose --build-type Release --jobs && \
    mv /openair-pcf/build/pcf/build/pcf /openair-pcf/build/pcf/build/oai_pcf && \
    # Remove entitlements and Subscription Manager configs
    rm -rf /etc/pki/entitlement && \
    rm -rf /etc/rhsm
Rohan's avatar
Rohan committed

FROM mikefarah/yq:latest as yq-source

Rohan's avatar
Rohan committed
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM registry.access.redhat.com/ubi9/ubi-minimal:latest as oai-pcf
Rohan's avatar
Rohan committed
ENV TZ=Europe/Paris

# 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


Rohan's avatar
Rohan committed
# We install some debug tools for the moment in addition of mandatory libraries
RUN rm -f /etc/rhsm-host && \
    microdnf update -y && \
    microdnf install -y \
# Debug Tools that are not mandatory
      iputils \
      tcpdump \
# Mandatory packages for the NF to run
#      libasan \
      findutils && \
    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
Rohan's avatar
Rohan committed

# Copying executable and generated libraries
WORKDIR /openair-pcf/bin
COPY --from=oai-pcf-builder \
    /openair-pcf/build/pcf/build/oai_pcf \
    /openair-pcf/scripts/healthcheck.sh \
Rohan's avatar
Rohan committed
    ./
COPY --from=yq-source /usr/bin/yq /usr/bin
Rohan's avatar
Rohan committed

COPY --from=oai-pcf-builder \
# Copying only the packages built from source
Rohan's avatar
Rohan committed
    /usr/local/lib64/libpistache.so.0 \
    /usr/local/lib/libnghttp2_asio.so \
    /usr/local/lib/libnghttp2_asio.so.1 \
    /usr/local/lib64/libspdlog.so \
    /usr/local/lib64/libfmt.so \
    /usr/local/lib64/libyaml-cpp.so.0.* \
Rohan's avatar
Rohan committed
    /usr/lib64/

Rohan's avatar
Rohan committed

# Copying template configuration files
# The configuration folder will be flat
WORKDIR /openair-pcf/etc
COPY --from=oai-pcf-builder \
Rohan's avatar
Rohan committed
    ./

WORKDIR /openair-pcf

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

CMD ["/openair-pcf/bin/oai_pcf", "-c", "/openair-pcf/etc/config.yaml", "-o"]