Commit 53030a32 authored by sagar arora's avatar sagar arora

dockerfile update

parent 328dbea9
......@@ -2,6 +2,7 @@
#
# Dockerfile for the Open-Air-Interface NRF service
# Valid for Ubuntu-18.04 (bionic)
# The port exposed by container are 8080/tcp , 9090/tcp change it according to your setup
#
#---------------------------------------------------------------------
......@@ -26,7 +27,7 @@ RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false
# Copying source code
COPY . /openair-nrf
COPY /oai-cn5g-nrf /openair-nrf
WORKDIR /openair-nrf
# Installing and Building NRF
......@@ -70,4 +71,10 @@ COPY --from=oai-nrf-builder /openair-nrf/docker/entrypoint.sh /openair-nrf/
WORKDIR /openair-nrf
#ENTRYPOINT ["/openair-nrf/entrypoint.sh"]
EXPOSE 8080/tcp 9090/tcp
RUN chmod +x entrypoint.sh
CMD ["/openair-nrf/bin/oai_nrf", "-c", "/openair-nrf/etc/nrf.conf", "-o"]
ENTRYPOINT ["/bin/bash","entrypoint.sh"]
\ No newline at end of file
......@@ -2,7 +2,7 @@ version: '3'
services:
oai_nrf:
container_name: "oai_nrf"
image: oainrf:1.0
image: oai-nrf:1.0
ports:
- 8080:8080
- 9092:9092
......@@ -11,9 +11,11 @@ services:
- 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
\ No newline at end of file
- subnet: 172.18.59.0/24
......@@ -6,27 +6,32 @@
#---------------------------------------------------------------------
#!/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]}"
set -euo pipefail
CONFIG_DIR="/openair-nrf/etc"
PUSH_PROTOCOL_OPTION=${PUSH_PROTOCOL_OPTION:-no}
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)
# 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
echo "Error: Environment variable '${NEW_VAR}' is not set." \
"Config file '$(basename $c)' requires all of $VARS."
exit 1
fi
EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
done
EXPRESSIONS="${EXPRESSIONS#';'}"
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
done
cd /openair-nrf/bin/ && ./oai_nrf -c /usr/local/etc/oai/nrf.conf -o
\ No newline at end of file
exec "$@"
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