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

dockerfile update

parent 328dbea9
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# #
# Dockerfile for the Open-Air-Interface NRF service # Dockerfile for the Open-Air-Interface NRF service
# Valid for Ubuntu-18.04 (bionic) # 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 ...@@ -26,7 +27,7 @@ RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false RUN git config --global http.sslverify false
# Copying source code # Copying source code
COPY . /openair-nrf COPY /oai-cn5g-nrf /openair-nrf
WORKDIR /openair-nrf WORKDIR /openair-nrf
# Installing and Building NRF # Installing and Building NRF
...@@ -70,4 +71,10 @@ COPY --from=oai-nrf-builder /openair-nrf/docker/entrypoint.sh /openair-nrf/ ...@@ -70,4 +71,10 @@ COPY --from=oai-nrf-builder /openair-nrf/docker/entrypoint.sh /openair-nrf/
WORKDIR /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' ...@@ -2,7 +2,7 @@ version: '3'
services: services:
oai_nrf: oai_nrf:
container_name: "oai_nrf" container_name: "oai_nrf"
image: oainrf:1.0 image: oai-nrf:1.0
ports: ports:
- 8080:8080 - 8080:8080
- 9092:9092 - 9092:9092
...@@ -11,9 +11,11 @@ services: ...@@ -11,9 +11,11 @@ services:
- NRF_INTERFACE_PORT_FOR_SBI=8080 - NRF_INTERFACE_PORT_FOR_SBI=8080
- NRF_INTERFACE_HTTP2_PORT_FOR_SBI=9090 - NRF_INTERFACE_HTTP2_PORT_FOR_SBI=9090
- NRF_API_VERSION=v1 - NRF_API_VERSION=v1
- INSTANCE=0
- PID_DIRECTORY=/var/run
networks: networks:
default: default:
driver: bridge driver: bridge
ipam: ipam:
config: config:
- subnet: 172.18.59.0/24 - subnet: 172.18.59.0/24
\ No newline at end of file
...@@ -6,27 +6,32 @@ ...@@ -6,27 +6,32 @@
#--------------------------------------------------------------------- #---------------------------------------------------------------------
#!/bin/bash #!/bin/bash
INSTANCE=1 set -euo pipefail
PREFIX='/usr/local/etc/oai'
mkdir -m 0777 -p $PREFIX CONFIG_DIR="/openair-nrf/etc"
cp /openair-nrf/etc/nrf.conf $PREFIX PUSH_PROTOCOL_OPTION=${PUSH_PROTOCOL_OPTION:-no}
declare -A NRF_CONF for c in ${CONFIG_DIR}/*.conf; do
# grep variable names (format: ${VAR}) from template to be rendered
NRF_CONF[@INSTANCE@]=$INSTANCE VARS=$(grep -oP '@[a-zA-Z0-9_]+@' ${c} | sort | uniq | xargs)
NRF_CONF[@PREFIX@]=$PREFIX
NRF_CONF[@PID_DIRECTORY@]='/var/run' # create sed expressions for substituting each occurrence of ${VAR}
# with the value of the environment variable "VAR"
NRF_CONF[@NRF_INTERFACE_NAME_FOR_SBI@]=$NRF_INTERFACE_NAME_FOR_SBI EXPRESSIONS=""
for v in ${VARS}; do
NRF_CONF[@NRF_INTERFACE_PORT_FOR_SBI@]=$NRF_INTERFACE_PORT_FOR_SBI NEW_VAR=`echo $v | sed -e "s#@##g"`
NRF_CONF[@NRF_INTERFACE_HTTP2_PORT_FOR_SBI@]=$NRF_INTERFACE_HTTP2_PORT_FOR_SBI if [[ "${!NEW_VAR}x" == "x" ]]; then
NRF_CONF[@NRF_API_VERSION@]=$NRF_API_VERSION echo "Error: Environment variable '${NEW_VAR}' is not set." \
"Config file '$(basename $c)' requires all of $VARS."
exit 1
for K in "${!NRF_CONF[@]}"; do fi
egrep -lRZ "$K" $PREFIX | xargs -0 -l sed -i -e "s|$K|${NRF_CONF[$K]}|g" EXPRESSIONS="${EXPRESSIONS};s|${v}|${!NEW_VAR}|g"
ret=$?;[[ ret -ne 0 ]] && echo "Tried to replace $K with ${NRF_CONF[$K]}" done
EXPRESSIONS="${EXPRESSIONS#';'}"
# render template and inline replace config file
sed -i "${EXPRESSIONS}" ${c}
done done
cd /openair-nrf/bin/ && ./oai_nrf -c /usr/local/etc/oai/nrf.conf -o 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