summaryrefslogtreecommitdiffstats
path: root/VNFs
diff options
context:
space:
mode:
authorLuc Provoost <luc.provoost@gmail.com>2023-02-02 19:12:08 +0100
committerLuc Provoost <luc.provoost@gmail.com>2023-02-02 19:12:08 +0100
commit7a8aefa95e91371252eea44a0ba5ca7068712c57 (patch)
treef18eafe8bc05c370850ee723a422d80e752b30c8 /VNFs
parent2683dc1412fe967057a3eeea2974621718783139 (diff)
Use ubuntu for containers
Changed the Dockerfile to install DPDK 22.07 and to run on Ubuntu 20.04. runrapid.py will now use the 'rapid' user to connect to the PROX instances. Signed-off-by: Luc Provoost <luc.provoost@gmail.com> Change-Id: I2df48f435e6d572343a02b2ab2c1db116c83ecad
Diffstat (limited to 'VNFs')
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/Dockerfile89
-rw-r--r--VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py2
2 files changed, 75 insertions, 16 deletions
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/Dockerfile b/VNFs/DPPD-PROX/helper-scripts/rapid/Dockerfile
index 2c25f097..fef0fcaf 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/Dockerfile
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/Dockerfile
@@ -17,42 +17,101 @@
##################################################
# Build all components in separate builder image #
##################################################
-FROM centos:7 as builder
-ARG BUILD_DIR=/opt/rapid
+FROM ubuntu:20.04 as builder
-COPY ./port_info ${BUILD_DIR}/port_info
+ARG DPDK_VERSION=22.07
+ENV DPDK_VERSION=${DPDK_VERSION}
-COPY ./deploycentostools.sh ${BUILD_DIR}/
-RUN chmod +x ${BUILD_DIR}/deploycentostools.sh \
- && ${BUILD_DIR}/deploycentostools.sh -k deploy
+ARG BUILD_DIR="/opt/rapid"
+ENV BUILD_DIR=${BUILD_DIR}
+
+ENV DEBIAN_FRONTEND=noninteractive
+
+# Install Dependencies
+RUN apt update && apt -y install git wget gcc unzip libpcap-dev libncurses5-dev \
+ libedit-dev liblua5.3-dev linux-headers-generic iperf3 pciutils \
+ libnuma-dev vim tuna wireshark make driverctl openssh-server sudo \
+ meson python3-pyelftools pkg-config
+
+WORKDIR ${BUILD_DIR}
+
+# Install DPDK
+RUN wget http://fast.dpdk.org/rel/dpdk-${DPDK_VERSION}.tar.xz \
+ && tar -xf ./dpdk-${DPDK_VERSION}.tar.xz \
+ && cd dpdk-${DPDK_VERSION} \
+ && meson build -Dlibdir=lib/x86_64-linux-gnu -Denable_driver_sdk=true \
+ && ninja -C build install
+
+WORKDIR ${BUILD_DIR}
+
+# Install Prox
+RUN git clone https://gerrit.opnfv.org/gerrit/samplevnf \
+ && cd samplevnf/VNFs/DPPD-PROX \
+ && COMMIT_ID=$(git rev-parse HEAD) \
+ && echo "${COMMIT_ID}" > ${BUILD_DIR}/commit_id \
+ && meson build \
+ && ninja -C build \
+ && cp ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX/build/prox ${BUILD_DIR}/prox
+
+# Build and copy port info app
+WORKDIR ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX/helper-scripts/rapid/port_info
+RUN meson build \
+ && ninja -C build \
+ && cp ${BUILD_DIR}/samplevnf/VNFs/DPPD-PROX/helper-scripts/rapid/port_info/build/port_info_app ${BUILD_DIR}/port_info_app
+
+RUN ldconfig && pkg-config --modversion libdpdk > ${BUILD_DIR}/dpdk_version
+# Create Minimal Install
+RUN ldd ${BUILD_DIR}/prox | awk '$2 ~ /=>/ {print $3}' >> ${BUILD_DIR}/list_of_install_components \
+ && echo "${BUILD_DIR}/prox" >> ${BUILD_DIR}/list_of_install_components \
+ && echo "${BUILD_DIR}/port_info_app" >> ${BUILD_DIR}/list_of_install_components \
+ && echo "${BUILD_DIR}/commit_id" >> ${BUILD_DIR}/list_of_install_components \
+ && echo "${BUILD_DIR}/dpdk_version" >> ${BUILD_DIR}/list_of_install_components \
+ && find /usr/local/lib/x86_64-linux-gnu -not -path '*/\.*' >> ${BUILD_DIR}/list_of_install_components \
+ && tar -czvhf ${BUILD_DIR}/install_components.tgz -T ${BUILD_DIR}/list_of_install_components
#############################
# Create slim runtime image #
#############################
-FROM centos:7
+FROM ubuntu:20.04
+
+ARG BUILD_DIR="/opt/rapid"
+ENV BUILD_DIR=${BUILD_DIR}
-ARG BUILD_DIR=/opt/rapid
+ENV DEBIAN_FRONTEND=noninteractive
+
+# Install Runtime Dependencies
+RUN apt update -y
+# Install required dynamically linked libraries + required packages
+RUN apt -y install sudo openssh-server libatomic1
-COPY ./deploycentostools.sh ${BUILD_DIR}/
COPY --from=builder ${BUILD_DIR}/install_components.tgz ${BUILD_DIR}/install_components.tgz
-COPY --from=builder ${BUILD_DIR}/src ${BUILD_DIR}/src
-RUN chmod a+rwx ${BUILD_DIR} && chmod +x ${BUILD_DIR}/deploycentostools.sh \
- && ${BUILD_DIR}/deploycentostools.sh -k runtime_image
+WORKDIR /
+RUN tar -xvf ${BUILD_DIR}/install_components.tgz --skip-old-files
+RUN ldconfig
+RUN rm ${BUILD_DIR}/install_components.tgz
# Expose SSH and PROX ports
EXPOSE 22 8474
+RUN useradd -rm -d /home/rapid -s /bin/bash -g root -G sudo -u 1000 rapid \
+ && chmod 777 ${BUILD_DIR} \
+ && echo 'rapid:rapid' | chpasswd \
+ && mkdir /home/rapid/.ssh
+
# Copy SSH keys
-COPY ./rapid_rsa_key.pub /home/centos/.ssh/authorized_keys
+COPY ./rapid_rsa_key.pub /home/rapid/.ssh/authorized_keys
COPY ./rapid_rsa_key.pub /root/.ssh/authorized_keys
-RUN chown centos:centos /home/centos/.ssh/authorized_keys \
- && chmod 600 /home/centos/.ssh/authorized_keys \
+RUN chown rapid:root /home/rapid/.ssh/authorized_keys \
+ && chmod 600 /home/rapid/.ssh/authorized_keys \
&& chown root:root /root/.ssh/authorized_keys \
&& chmod 600 /root/.ssh/authorized_keys
+#RUN apt-get clean && apt autoremove --purge
+RUN apt-get autoremove -y && apt-get clean all && rm -rf /var/cache/apt
+
# Copy startup script
COPY ./start.sh /start.sh
RUN chmod +x /start.sh
diff --git a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py
index 92b39796..74f3a047 100644
--- a/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py
+++ b/VNFs/DPPD-PROX/helper-scripts/rapid/rapid_k8s_deployment.py
@@ -32,7 +32,7 @@ class K8sDeployment:
"""
LOG_FILE_NAME = "createrapidk8s.log"
SSH_PRIVATE_KEY = "./rapid_rsa_key"
- SSH_USER = "centos"
+ SSH_USER = "rapid"
POD_YAML_TEMPLATE_FILE_NAME = "pod-rapid.yaml"