-
Notifications
You must be signed in to change notification settings - Fork 55
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ric Li <[email protected]>
- Loading branch information
Showing
5 changed files
with
199 additions
and
102 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
.dockerignore | ||
.git/ | ||
.gitignore | ||
.github/ | ||
.clang-format | ||
.vscode/ | ||
.cache/ | ||
|
||
CODEOWNERS | ||
LICENSE | ||
README.md | ||
doc | ||
|
||
*.log | ||
*.patch | ||
*.diff | ||
*.yuv | ||
*.pcapng | ||
*.pcap | ||
*.raw | ||
*.dat | ||
*.json | ||
!kahawai.json | ||
html/ | ||
test.* | ||
build/ | ||
core* | ||
out* | ||
assets/ | ||
*.pkg | ||
*.jxs | ||
*.mkv | ||
*.zip | ||
*.gz | ||
*.tar | ||
mtl_system_status_* | ||
*.pyc | ||
*.mp4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
########################## | ||
## Hadolint config file ## | ||
########################## | ||
ignored: | ||
- DL3008 # Ignore pinned versions check for APT |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,82 @@ | ||
# SPDX-License-Identifier: BSD-3-Clause | ||
# Copyright 2023 Intel Corporation | ||
|
||
FROM ubuntu@sha256:dfd64a3b4296d8c9b62aa3309984f8620b98d87e47492599ee20739e8eb54fbf | ||
# 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. | ||
|
||
LABEL maintainer="[email protected]" | ||
# Ubuntu 22.04, build stage | ||
FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 AS builder | ||
|
||
ENV MTL_REPO=Media-Transport-Library | ||
ENV DPDK_REPO=dpdk | ||
ENV DPDK_VER=23.07 | ||
ENV IMTL_USER=imtl | ||
|
||
RUN apt-get update -y | ||
|
||
# Install dependencies | ||
RUN apt-get install -y git gcc meson python3 python3-pip pkg-config libnuma-dev libjson-c-dev libpcap-dev libgtest-dev libsdl2-dev libsdl2-ttf-dev libssl-dev | ||
|
||
RUN pip install pyelftools ninja | ||
|
||
RUN apt-get install -y sudo | ||
|
||
# some misc tools | ||
RUN apt-get install -y vim htop | ||
|
||
RUN apt clean all | ||
LABEL maintainer="[email protected],[email protected]" | ||
|
||
# user: imtl | ||
RUN adduser $IMTL_USER | ||
RUN usermod -G sudo $IMTL_USER | ||
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers | ||
USER $IMTL_USER | ||
# Install build dependencies and debug tools | ||
RUN apt-get update -y && \ | ||
apt-get install -y --no-install-recommends git build-essential meson python3 python3-pyelftools pkg-config libnuma-dev libjson-c-dev libpcap-dev libgtest-dev libsdl2-dev libsdl2-ttf-dev libssl-dev ca-certificates && \ | ||
apt-get install -y --no-install-recommends m4 clang llvm zlib1g-dev libelf-dev libcap-ng-dev libcap2-bin gcc-multilib && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
WORKDIR /home/$IMTL_USER/ | ||
|
||
RUN git config --global user.email "[email protected]" && \ | ||
git config --global user.name "Your Name" | ||
|
||
RUN git clone https://github.com/OpenVisualCloud/$MTL_REPO.git | ||
|
||
RUN git clone https://github.com/DPDK/$DPDK_REPO.git && \ | ||
cd $DPDK_REPO && \ | ||
git checkout v$DPDK_VER && \ | ||
git switch -c v$DPDK_VER | ||
|
||
# build dpdk | ||
RUN cd $DPDK_REPO && \ | ||
git am ../Media-Transport-Library/patches/dpdk/$DPDK_VER/*.patch && \ | ||
meson build && \ | ||
ninja -C build && \ | ||
sudo ninja -C build install && \ | ||
cd .. | ||
|
||
# build mtl | ||
RUN cd $MTL_REPO && \ | ||
./build.sh && \ | ||
cd .. | ||
|
||
CMD ["/bin/bash"] | ||
ENV MTL_REPO=Media-Transport-Library | ||
ENV DPDK_VER=23.07 | ||
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig | ||
|
||
COPY . $MTL_REPO | ||
|
||
# Clone DPDK and xdp-tools repo | ||
RUN git clone https://github.com/DPDK/dpdk.git && \ | ||
git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git | ||
|
||
# Build DPDK with Media-Transport-Library patches | ||
WORKDIR /dpdk | ||
RUN git checkout v$DPDK_VER && \ | ||
git switch -c v$DPDK_VER && \ | ||
git config --global user.email "[email protected]" && \ | ||
git config --global user.name "Your Name" && \ | ||
git am ../$MTL_REPO/patches/dpdk/$DPDK_VER/*.patch && \ | ||
meson setup build && \ | ||
meson install -C build && \ | ||
DESTDIR=/install meson install -C build | ||
|
||
# Build the xdp-tools project | ||
WORKDIR /xdp-tools | ||
RUN ./configure && make &&\ | ||
make install && \ | ||
DESTDIR=/install make install | ||
WORKDIR /xdp-tools/lib/libbpf/src | ||
RUN make install && \ | ||
DESTDIR=/install make install | ||
|
||
# Build IMTL | ||
WORKDIR /$MTL_REPO | ||
RUN ./build.sh && \ | ||
DESTDIR=/install meson install -C build && \ | ||
setcap 'cap_net_raw+ep' ./build/app/RxTxApp | ||
|
||
# Ubuntu 22.04, runtime stage | ||
FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 AS final | ||
|
||
LABEL maintainer="[email protected],[email protected]" | ||
|
||
# Install runtime dependencies | ||
RUN apt-get update -y && \ | ||
apt-get install -y --no-install-recommends libnuma1 libjson-c5 libpcap0.8 libsdl2-2.0-0 libsdl2-ttf-2.0-0 libssl3 zlib1g libelf1 libcap-ng0 libatomic1 && \ | ||
apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
# 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 | ||
|
||
WORKDIR /home/imtl/ | ||
|
||
# ldconfig | ||
RUN ldconfig | ||
|
||
USER imtl | ||
|
||
CMD ["/bin/bash"] |