From 0baa5f6bc50d16bcb807cb5e9d9ed329c6b0fe64 Mon Sep 17 00:00:00 2001 From: dawidwesierski4 Date: Fri, 7 Feb 2025 11:11:22 +0100 Subject: [PATCH] Add: rockos dockerfile Add rockos dockerfile, to show docker support on RHEL based distribution. Change docker compose imtl service name to mtl_ubuntu to distinguish between distributions. --- docker/README.md | 3 +- docker/docker-compose.yml | 29 ++++++++- docker/rockos.dockerfile | 130 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 159 insertions(+), 3 deletions(-) create mode 100644 docker/rockos.dockerfile diff --git a/docker/README.md b/docker/README.md index f40f05447..6af001f0f 100644 --- a/docker/README.md +++ b/docker/README.md @@ -19,7 +19,8 @@ Refer to below build command if you are in a proxy env. ```bash http_proxy=http://proxy.xxx.com:xxx https_proxy=https://proxy.xxx.com:xxx -docker build -t mtl:latest -f ubuntu.dockerfile --build-arg HTTP_PROXY=$http_proxy --build-arg HTTPS_PROXY=$https_proxy ../ +docker build -t mtl_ubuntu:latest -f ubuntu.dockerfile --build-arg HTTP_PROXY=$http_proxy --build-arg HTTPS_PROXY=$https_proxy ../ +docker build -t mtl_rockos:latest -f ubuntu.dockerfile --build-arg HTTP_PROXY=$http_proxy --build-arg HTTPS_PROXY=$https_proxy ../ ``` ## 3. Run and login into the docker container diff --git a/docker/docker-compose.yml b/docker/docker-compose.yml index e968791fc..bca3e2818 100644 --- a/docker/docker-compose.yml +++ b/docker/docker-compose.yml @@ -1,8 +1,8 @@ version: '3' services: - imtl: - image: mtl:latest + mtl_ubuntu: + image: mtl_ubuntu:latest ulimits: memlock: soft: -1 @@ -20,5 +20,30 @@ services: # - NET_RAW # - CAP_BPF + # For Adjtime + # - SYS_TIME + + mtl_rockos: + image: mtl_rockos:latest + ulimits: + memlock: + soft: -1 + hard: -1 + devices: + - "/dev/vfio:/dev/vfio" # or add /dev/vfio/vfio and /dev/vfio/ + volumes: + - "/var/run/imtl:/var/run/imtl" # For connection with MTL Manager + - "/hugepages:/hugepages" + # If you have issues with ice driver not finding ddp location + # - /lib/firmware/intel/ice/ddp:/lib/firmware/intel/ice/ddp + # For kernel / AF_XDP backend + # network_mode: host + cap_add: + - SYS_NICE + - IPC_LOCK + # For kernel / AF_XDP backend + # - NET_RAW + # - CAP_BPF + # For Adjtime # - SYS_TIME \ No newline at end of file diff --git a/docker/rockos.dockerfile b/docker/rockos.dockerfile new file mode 100644 index 000000000..7074ea194 --- /dev/null +++ b/docker/rockos.dockerfile @@ -0,0 +1,130 @@ +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2025 Intel Corporation + +# NOTE: This Dockerfile is intended for development purposes only. +# It has been tested for functionality, but not for security. +# Please review and modify as necessary before using in a production environment. + +# rockylinux:9.3, build stage +FROM rockylinux@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 AS builder + +LABEL maintainer="andrzej.wilczynski@intel.com,dawid.wesierski@intel.com,marek.kasiewicz@intel.com" + +ENV MTL_REPO=Media-Transport-Library +ENV DPDK_VER=23.11 +ENV JSON_C_VER=0.16 +ENV PCAP_VER=1.9 +ENV GTEST_VER=1.13 +ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig + +# Install build dependencies and debug tools +RUN yum update -y && \ + yum install -y git \ + gcc \ + gcc-c++ \ + python3 \ + python3-pip \ + pkg-config \ + SDL2-devel \ + openssl-devel \ + numactl-devel \ + libasan \ + systemtap-sdt-devel \ + # TODO add documentation + cmake \ + flex \ + bison \ + patch \ + clang \ + llvm \ + zlib-devel \ + elfutils-libelf-devel \ + glibc-devel.i686 + + +RUN pip3 install meson ninja pyelftools + +WORKDIR /dependencies +RUN git clone https://github.com/json-c/json-c.git -b json-c-$JSON_C_VER && \ + git clone https://github.com/the-tcpdump-group/libpcap.git -b libpcap-$PCAP_VER && \ + git clone https://github.com/google/googletest.git -b v$GTEST_VER.x && \ + git clone https://github.com/DPDK/dpdk.git && \ + git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git + +WORKDIR /dependencies/json-c +RUN mkdir build && cd build && \ + cmake ../ && \ + make -j $(nproc) && \ + make install && \ + DESTDIR=/install make install + +WORKDIR /dependencies/libpcap +RUN ./configure && \ + make -j $(nproc) && \ + make install && \ + DESTDIR=/install make install + +# Instead of gtest googletest +WORKDIR /dependencies/googletest +RUN mkdir build && cd build && \ + cmake ../ && \ + make -j $(nproc) && \ + make install && \ + DESTDIR=/install make install + +# Build the xdp-tools project +WORKDIR /dependencies/xdp-tools +RUN ./configure && make &&\ + make install && \ + DESTDIR=/install make install +WORKDIR /dependencies/xdp-tools/lib/libbpf/src +RUN make install && \ + DESTDIR=/install make install + +COPY . /$MTL_REPO/ + +WORKDIR /dependencies/dpdk +RUN git checkout v$DPDK_VER && \ + git switch -c v$DPDK_VER && \ + for patch in /$MTL_REPO/patches/dpdk/23.11/*.patch; do \ + patch -p1 < "$patch"; \ + done && \ + meson setup build && \ + meson install -C build && \ + DESTDIR=/install meson install -C build + +# # secure_path for root user +# RUN sed -i '/^Defaults\s\+secure_path\s*=/ s|$|:/usr/local/bin|' /etc/sudoers + +# Build MTL +WORKDIR /$MTL_REPO +RUN ./build.sh && \ + DESTDIR=/install meson install -C build && \ + setcap 'cap_net_raw+ep' ./tests/tools/RxTxApp/build/RxTxApp + + +FROM rockylinux@sha256:d7be1c094cc5845ee815d4632fe377514ee6ebcf8efaed6892889657e5ddaaa6 AS final + +LABEL maintainer="andrzej.wilczynski@intel.com,dawid.wesierski@intel.com,marek.kasiewicz@intel.com" + +# Install build dependencies and debug tools +RUN yum update -y && \ + yum install -y SDL2-devel openssl-devel numactl-devel libasan systemtap-sdt-devel libatomic + +# Add user: imtl(1001) with group vfio(2110) +RUN groupadd -g 2110 vfio && \ + useradd -m -G vfio -u 1001 imtl + +# Copy libraries and binaries +COPY --chown=imtl --from=builder /install / +COPY --chown=imtl --from=builder /Media-Transport-Library/build /home/imtl +COPY --chown=imtl --from=builder /Media-Transport-Library/tests/tools/RxTxApp/build/RxTxApp /home/imtl/RxTxApp +COPY --chown=imtl --from=builder /Media-Transport-Library/tests/tools/RxTxApp/script /home/imtl/scripts + +WORKDIR /home/imtl/ + +RUN echo "/usr/local/lib" > /etc/ld.so.conf.d/local-lib.conf && ldconfig + +USER imtl + +CMD ["/bin/bash"]