Commit 328dbea9 authored by Sagar Arora's avatar Sagar Arora 🚴🏻
Browse files

dockerfile

parent 93f5a0ee
#---------------------------------------------------------------------
#
# Dockerfile for the Open-Air-Interface NRF service
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#---------------------------------------------------------------------
# BUILDER IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-nrf-builder
ARG NEEDED_GIT_PROXY
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
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"
RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# Copying source code
COPY . /openair-nrf
WORKDIR /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
#---------------------------------------------------------------------
# TARGET IMAGE
#---------------------------------------------------------------------
FROM ubuntu:bionic as oai-nrf
ENV DEBIAN_FRONTEND=noninteractive
ENV TZ=Europe
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
# 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 \
iputils-ping \
bc \
tshark \
libasan4 \
libgoogle-glog0v5 \
libdouble-conversion1 \
libconfig++9v5 \
libcurl4-gnutls-dev \
&& 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/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/
RUN ldconfig
# Copying template configuration files
COPY --from=oai-nrf-builder /openair-nrf/etc/nrf.conf /openair-nrf/etc/
COPY --from=oai-nrf-builder /openair-nrf/docker/entrypoint.sh /openair-nrf/
WORKDIR /openair-nrf
#ENTRYPOINT ["/openair-nrf/entrypoint.sh"]
version: '3'
services:
oai_nrf:
container_name: "oai_nrf"
image: oainrf: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
networks:
default:
driver: bridge
ipam:
config:
- subnet: 172.18.59.0/24
\ No newline at end of file
#---------------------------------------------------------------------
#
# Docker entrypoint file for setting up environment variables and generating conf file
# Valid for Ubuntu-18.04 (bionic)
#
#---------------------------------------------------------------------
#!/bin/bash
INSTANCE=1
PREFIX='/usr/local/etc/oai'
mkdir -m 0777 -p $PREFIX
cp /openair-nrf/etc/nrf.conf $PREFIX
declare -A NRF_CONF
NRF_CONF[@INSTANCE@]=$INSTANCE
NRF_CONF[@PREFIX@]=$PREFIX
NRF_CONF[@PID_DIRECTORY@]='/var/run'
NRF_CONF[@NRF_INTERFACE_NAME_FOR_SBI@]=$NRF_INTERFACE_NAME_FOR_SBI
NRF_CONF[@NRF_INTERFACE_PORT_FOR_SBI@]=$NRF_INTERFACE_PORT_FOR_SBI
NRF_CONF[@NRF_INTERFACE_HTTP2_PORT_FOR_SBI@]=$NRF_INTERFACE_HTTP2_PORT_FOR_SBI
NRF_CONF[@NRF_API_VERSION@]=$NRF_API_VERSION
for K in "${!NRF_CONF[@]}"; do
egrep -lRZ "$K" $PREFIX | xargs -0 -l sed -i -e "s|$K|${NRF_CONF[$K]}|g"
ret=$?;[[ ret -ne 0 ]] && echo "Tried to replace $K with ${NRF_CONF[$K]}"
done
cd /openair-nrf/bin/ && ./oai_nrf -c /usr/local/etc/oai/nrf.conf -o
\ 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