Commit e34387d5 authored by sagar arora's avatar sagar arora

update ubuntu and rhel dockerfie

parent c4970890
#/*
# * 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
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 && \
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
# 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 \
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 /openair-nrf/build/nrf/build/nas/libNAS.so /usr/lib64/
COPY --from=oai-nrf-builder /openair-nrf/scripts/entrypoint.sh entrypoint.sh
# 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
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
ENTRYPOINT ["/openair-nrf/bin/entrypoint.sh"]
\ No newline at end of file
......@@ -59,11 +59,11 @@ 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
......@@ -71,11 +71,9 @@ 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"]
\ No newline at end of file
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
\ No newline at end of file
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