Commit e9b6d070 authored by Raphael Defosseux's avatar Raphael Defosseux

[docker] adding entrypoint and template generation to dockerfile for u18

Signed-off-by: default avatarRaphael Defosseux <raphael.defosseux@eurecom.fr>
parent 152f7345
...@@ -35,6 +35,10 @@ RUN /bin/sh oaienv && \ ...@@ -35,6 +35,10 @@ RUN /bin/sh oaienv && \
mkdir -p log && \ mkdir -p log && \
./build_oai --eNB --ninja -w USRP ./build_oai --eNB --ninja -w USRP
RUN apt-get install -y python3-pip && \
pip3 install --ignore-installed pyyaml && \
python3 ./docker/scripts/generateTemplate.py ./docker/scripts/parameters.yaml
# debug # debug
#RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15 #RUN ldconfig -v && ldd /oai-ran/targets/bin/lte-softmodem.Rel15
#RUN ls -ls /oai-ran/targets/bin #RUN ls -ls /oai-ran/targets/bin
...@@ -73,6 +77,7 @@ RUN apt-get update && \ ...@@ -73,6 +77,7 @@ RUN apt-get update && \
WORKDIR /opt/oai-enb/bin WORKDIR /opt/oai-enb/bin
COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/lte-softmodem.Rel15 .
COPY --from=enb-build /oai-ran/docker/scripts/enb_entrypoint.sh entrypoint.sh
WORKDIR /usr/local/lib/ WORKDIR /usr/local/lib/
COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 . COPY --from=enb-build /oai-ran/targets/bin/liboai_eth_transpro.so.Rel15 .
...@@ -104,21 +109,16 @@ RUN ldconfig ...@@ -104,21 +109,16 @@ RUN ldconfig
# Copy the relevant configuration files for eNB # Copy the relevant configuration files for eNB
WORKDIR /opt/oai-enb/etc WORKDIR /opt/oai-enb/etc
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/enb.* ./ COPY --from=enb-build /oai-ran/docker/etc .
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rcc.* ./
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/cu.* ./
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/du.* ./
COPY --from=enb-build /oai-ran/ci-scripts/conf_files/rru.* ./
WORKDIR /opt/oai-enb WORKDIR /opt/oai-enb
#EXPOSE 2152/udp # S1U, GTP/UDP EXPOSE 2152/udp # S1U, GTP/UDP
EXPOSE 36412/udp # S1C, SCTP/UDP
EXPOSE 36422/udp # X2C, SCTP/UDP
#EXPOSE 22100/tcp # ? #EXPOSE 22100/tcp # ?
#EXPOSE 36412/udp # S1C, SCTP/UDP
#EXPOSE 36422/udp # X2C, SCTP/UDP
#EXPOSE 50000/udp # IF5 / ORI (control) #EXPOSE 50000/udp # IF5 / ORI (control)
#EXPOSE 50001/udp # IF5 / ECPRI (data) #EXPOSE 50001/udp # IF5 / ECPRI (data)
#CMD ["/opt/oai-enb/bin/lte-softmodem", "-O", "/opt/oai-enb/etc/enb.conf"] ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"]
#ENTRYPOINT ["/opt/oai-enb/bin/entrypoint.sh"] CMD ["/opt/oai-enb/bin/lte-softmodem.Rel15", "-O", "/opt/oai-enb/etc/enb.conf"]
CMD ["sleep", "infinity"]
#!/bin/bash
set -euo pipefail
# Based another env var
if [[ -v USE_FDD_CU ]]; then ln -s /opt/oai-enb/etc/cu.fdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_FDD_DU ]]; then ln -s /opt/oai-enb/etc/du.fdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_FDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_TDD_MONO ]]; then ln -s /opt/oai-enb/etc/enb.tdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_FDD_RCC ]]; then ln -s /opt/oai-enb/etc/rcc.if4p5.enb.fdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_FDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.fdd.conf /opt/oai-enb/etc/enb.conf; fi
if [[ -v USE_TDD_RRU ]]; then ln -s /opt/oai-enb/etc/rru.tdd.conf /opt/oai-enb/etc/enb.conf; fi
CONFIG_FILES=`ls /opt/oai-enb/etc/enb.conf`
for c in ${CONFIG_FILES}; 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
# Later-on, how to add command lines options?
# Load the USRP binaries
# --> later conditional (when doing simulators)
/usr/lib/uhd/utils/uhd_images_downloader.py
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