Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add: rockos dockerfile #1070

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions doc/run.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,16 @@ sudo sysctl -w vm.nr_hugepages=2048

The number is dependent on the workloads you wish to execute. Consider increasing the value if memory allocation failures occur during runtime.

### 4.1 User hughpage limitations

Some systems (mainly RHEL family) will limit the amout of memory user can allocate in hughpages you can add those in the following file
```bash
/etc/security/limits.d/24-memlock.conf
user_name hard memlock unlimited
user_name soft memlock unlimited

```

## 5. Run the Sample Application

### 5.1. Prepare Source Files
Expand Down
3 changes: 2 additions & 1 deletion docker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 27 additions & 2 deletions docker/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
version: '3'

services:
imtl:
image: mtl:latest
mtl_ubuntu:
image: mtl_ubuntu:latest
ulimits:
memlock:
soft: -1
Expand All @@ -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/<specific_device>
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
130 changes: 130 additions & 0 deletions docker/rockos.dockerfile
Original file line number Diff line number Diff line change
@@ -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"]
Loading