|
1 | | -# SPDX-License-Identifier: BSD-3-Clause |
2 | | -# Copyright 2023 Intel Corporation |
| 1 | +# syntax=docker/dockerfile:1 |
3 | 2 |
|
4 | | -# NOTE: This Dockerfile is intended for development purposes only. |
5 | | -# It has been tested for functionality, but not for security. |
6 | | -# Please review and modify as necessary before using in a production environment. |
| 3 | +# Copyright (c) 2025 Intel Corporation. |
| 4 | +# SPDX-License-Identifier: BSD-3-Clause |
7 | 5 |
|
8 | | -# Ubuntu 22.04, build stage |
9 | | -FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 AS builder |
| 6 | +# Ubuntu 22.04, builder stage |
| 7 | +ARG IMAGE_CACHE_REGISTRY=docker.io |
| 8 | +FROM "${IMAGE_CACHE_REGISTRY}/library/ubuntu:22.04@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37" AS builder |
10 | 9 |
|
11 | 10 | |
12 | 11 |
|
| 12 | +ARG NPROC=20 |
| 13 | +ARG DPDK_VER=25.03 |
| 14 | +ARG PREFIX_PATH=/opt/intel |
| 15 | +ARG MTL_REPO=${PREFIX_PATH}/mtl |
| 16 | +ENV XDP_REPO=${PREFIX_PATH}/xdp |
| 17 | +ENV DPDK_REPO=${PREFIX_PATH}/dpdk |
| 18 | +ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig |
| 19 | +ENV DEBIAN_FRONTEND="noninteractive" |
| 20 | +ENV TZ="Europe/Warsaw" |
| 21 | + |
| 22 | +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] |
| 23 | + |
13 | 24 | # Install build dependencies and debug tools |
| 25 | +WORKDIR "${DPDK_REPO}" |
| 26 | +RUN apt-get update -y && \ |
| 27 | + apt-get upgrade -y && \ |
| 28 | + apt-get install -y --no-install-recommends ca-certificates sudo curl unzip apt-transport-https apt-utils python3-dev && \ |
| 29 | + apt-get autoremove -y && \ |
| 30 | + rm -rf /var/lib/apt/lists/* && \ |
| 31 | + curl -fsSL https://bootstrap.pypa.io/get-pip.py | python3 && \ |
| 32 | + python3 -m pip --no-cache-dir install --upgrade pip setuptools |
| 33 | + |
| 34 | +WORKDIR "${MTL_REPO}" |
14 | 35 | RUN apt-get update -y && \ |
15 | | - apt-get install -y --no-install-recommends systemtap-sdt-dev && \ |
16 | | - 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 && \ |
17 | | - apt-get install -y --no-install-recommends m4 clang llvm zlib1g-dev libelf-dev libcap-ng-dev libcap2-bin gcc-multilib && \ |
| 36 | + apt-get install -y --no-install-recommends git build-essential python3-pyelftools pkg-config libnuma-dev libjson-c-dev libpcap-dev libgtest-dev libsdl2-dev libsdl2-ttf-dev libssl-dev && \ |
| 37 | + apt-get install -y --no-install-recommends m4 clang llvm zlib1g-dev libelf-dev libcap-ng-dev libcap2-bin gcc-multilib systemtap-sdt-dev && \ |
| 38 | + apt-get autoremove -y && \ |
18 | 39 | apt-get clean && \ |
19 | | - rm -rf /var/lib/apt/lists/* |
20 | | - |
21 | | -ENV MTL_REPO=Media-Transport-Library |
22 | | -ENV DPDK_VER=25.03 |
23 | | -ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig |
| 40 | + rm -rf /var/lib/apt/lists/* && \ |
| 41 | + python3 -m pip --no-cache-dir install meson ninja |
24 | 42 |
|
25 | | -COPY . $MTL_REPO |
| 43 | +COPY . "${MTL_REPO}" |
26 | 44 |
|
27 | 45 | # Clone DPDK and xdp-tools repo |
28 | | -RUN git clone https://github.com/DPDK/dpdk.git && \ |
29 | | - git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git |
| 46 | +WORKDIR "${XDP_REPO}" |
| 47 | +RUN git clone https://github.com/DPDK/dpdk.git "${DPDK_REPO}" && \ |
| 48 | + git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git "${XDP_REPO}" |
30 | 49 |
|
31 | 50 | # Build DPDK with Media-Transport-Library patches |
32 | | -WORKDIR /dpdk |
| 51 | +WORKDIR "${DPDK_REPO}" |
33 | 52 | RUN git checkout v$DPDK_VER && \ |
34 | 53 | git switch -c v$DPDK_VER && \ |
35 | 54 | git config --global user.email "[email protected]" && \ |
36 | 55 | git config --global user.name "Your Name" && \ |
37 | | - git am ../$MTL_REPO/patches/dpdk/$DPDK_VER/*.patch && \ |
| 56 | + git am "${MTL_REPO}/patches/dpdk/${DPDK_VER}/"*.patch && \ |
38 | 57 | meson setup build && \ |
39 | | - meson install -C build && \ |
40 | | - DESTDIR=/install meson install -C build |
| 58 | + ninja -C build && \ |
| 59 | + ninja -C build install && \ |
| 60 | + DESTDIR=/install ninja -C build install |
41 | 61 |
|
42 | 62 | # Build the xdp-tools project |
43 | | -WORKDIR /xdp-tools |
44 | | -RUN ./configure && make &&\ |
45 | | - make install && \ |
46 | | - DESTDIR=/install make install |
47 | | -WORKDIR /xdp-tools/lib/libbpf/src |
48 | | -RUN make install && \ |
49 | | - DESTDIR=/install make install |
| 63 | +WORKDIR "${XDP_REPO}" |
| 64 | +RUN ./configure && \ |
| 65 | + make -j${NPROC:-$(nproc)} && \ |
| 66 | + make -j${NPROC:-8} install && \ |
| 67 | + DESTDIR=/install make -j${NPROC:-8} install && \ |
| 68 | + mkdir -p "${XDP_REPO}/lib/libbpf/src" && \ |
| 69 | + make -C "${XDP_REPO}/lib/libbpf/src" -j${NPROC:-$(nproc)} && \ |
| 70 | + make -C "${XDP_REPO}/lib/libbpf/src" -j${NPROC:-8} install && \ |
| 71 | + DESTDIR=/install make -C "${XDP_REPO}/lib/libbpf/src" -j${NPROC:-8} install |
50 | 72 |
|
51 | 73 | # Build MTL |
52 | | -WORKDIR /$MTL_REPO |
53 | | -RUN ./build.sh && \ |
54 | | - DESTDIR=/install meson install -C build && \ |
55 | | - setcap 'cap_net_raw+ep' ./tests/tools/RxTxApp/build/RxTxApp |
56 | | - |
57 | | -# Ubuntu 22.04, runtime stage |
58 | | -FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 AS final |
59 | | - |
60 | | - |
| 74 | +WORKDIR "${MTL_REPO}" |
| 75 | +RUN "${MTL_REPO}/build.sh" && \ |
| 76 | + ninja -C "${MTL_REPO}/build" && \ |
| 77 | + ninja -C "${MTL_REPO}/build" install && \ |
| 78 | + DESTDIR=/install ninja -C "${MTL_REPO}/build" install && \ |
| 79 | + setcap 'cap_net_raw+ep' "${MTL_REPO}/tests/tools/RxTxApp/build/RxTxApp" |
| 80 | + |
| 81 | +# Ubuntu 22.04, runtime/final stage |
| 82 | +ARG MTL_REPO |
| 83 | +ARG IMAGE_CACHE_REGISTRY |
| 84 | +FROM "${IMAGE_CACHE_REGISTRY}/library/ubuntu:22.04@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37" AS final |
| 85 | + |
| 86 | + |
| 87 | +LABEL org.opencontainers.image.url="https://github.com/OpenVisualCloud/Media-Transport-Library" |
| 88 | +LABEL org.opencontainers.image.title="Intel® Media Transport Library" |
| 89 | +LABEL org.opencontainers.image.description="Intel® Media Transport Library (MTL), a real-time media transport(DPDK, AF_XDP, RDMA) stack for both raw and compressed video based on COTS hardware" |
| 90 | +LABEL org.opencontainers.image.documentation="https://openvisualcloud.github.io/Media-Transport-Library/README.html" |
| 91 | +LABEL org.opencontainers.image.version="1.26.0" |
| 92 | +LABEL org.opencontainers.image.vendor="Intel® Corporation" |
| 93 | +LABEL org.opencontainers.image.licenses="BSD 3-Clause License" |
| 94 | + |
| 95 | +ARG PREFIX_PATH=/opt/intel |
| 96 | +ARG MTL_REPO=${PREFIX_PATH}/mtl |
| 97 | +ENV DEBIAN_FRONTEND="noninteractive" |
| 98 | +ENV TZ="Europe/Warsaw" |
| 99 | +SHELL ["/bin/bash", "-ex", "-o", "pipefail", "-c"] |
61 | 100 |
|
62 | 101 | # Install runtime dependencies |
63 | | -RUN apt-get update -y && \ |
| 102 | +WORKDIR /home/imtl/ |
| 103 | +RUN apt-get clean -y && rm -rf /var/lib/apt/lists/* && \ |
| 104 | + apt-get update -y && \ |
| 105 | + apt-get install -y --no-install-recommends ca-certificates sudo curl unzip && \ |
64 | 106 | 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 && \ |
| 107 | + apt-get autoremove -y && \ |
65 | 108 | apt-get clean && \ |
66 | | - rm -rf /var/lib/apt/lists/* |
67 | | - |
68 | | -# Add user: imtl(1001) with group vfio(2110) |
69 | | -RUN groupadd -g 2110 vfio && \ |
70 | | - useradd -m -G vfio -u 1001 imtl |
| 109 | + rm -rf /var/lib/apt/lists/* && \ |
| 110 | + echo "Add user: imtl(20001) with group vfio(2110)" && \ |
| 111 | + groupadd -g 2110 vfio && \ |
| 112 | + useradd -m -G vfio,root,sudo -u 20001 imtl |
71 | 113 |
|
72 | 114 | # Copy libraries and binaries |
73 | 115 | COPY --chown=imtl --from=builder /install / |
74 | | -COPY --chown=imtl --from=builder /Media-Transport-Library/build /home/imtl |
75 | | -COPY --chown=imtl --from=builder /Media-Transport-Library/tests/tools/RxTxApp/build/RxTxApp /home/imtl/RxTxApp |
76 | | -COPY --chown=imtl --from=builder /Media-Transport-Library/tests/tools/RxTxApp/script /home/imtl/scripts |
77 | | - |
78 | | -WORKDIR /home/imtl/ |
| 116 | +COPY --chown=imtl --from=builder "${MTL_REPO}/build" "/home/imtl" |
| 117 | +COPY --chown=imtl --from=builder "${MTL_REPO}/tests/tools/RxTxApp/build/RxTxApp" "/home/imtl/RxTxApp" |
| 118 | +COPY --chown=imtl --from=builder "${MTL_REPO}/tests/tools/RxTxApp/script" "/home/imtl/scripts" |
79 | 119 |
|
80 | | -# ldconfig |
81 | 120 | RUN ldconfig |
| 121 | +SHELL ["/bin/bash", "-c"] |
82 | 122 |
|
83 | 123 | USER imtl |
84 | 124 | HEALTHCHECK --interval=30s --timeout=5s CMD true || exit 1 |
|
0 commit comments