Skip to content

Commit

Permalink
docker: add xdp deps in Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: Ric Li <[email protected]>
  • Loading branch information
ricmli committed Dec 8, 2023
1 parent 514e6b7 commit 27e7e22
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 44 deletions.
68 changes: 31 additions & 37 deletions docker/ubuntu.dockerfile
Original file line number Diff line number Diff line change
@@ -1,58 +1,52 @@
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2023 Intel Corporation

FROM ubuntu@sha256:dfd64a3b4296d8c9b62aa3309984f8620b98d87e47492599ee20739e8eb54fbf
# Ubuntu 22.04
FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37

LABEL maintainer="[email protected]"
LABEL maintainer="[email protected],[email protected]"

ENV MTL_REPO=Media-Transport-Library
ENV DPDK_REPO=dpdk
ENV DPDK_VER=23.11
ENV IMTL_USER=imtl
ENV PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib64/pkgconfig

# Install dependencies and debug tools
RUN apt-get update -y && \
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 && \
apt-get install -y make m4 clang llvm zlib1g-dev libelf-dev libcap-ng-dev && \
apt-get install -y sudo vim htop gdb && \
pip install pyelftools ninja && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Add user: imtl
RUN adduser $IMTL_USER && \
usermod -G sudo $IMTL_USER && \
echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers

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

# user: imtl
RUN adduser $IMTL_USER
RUN usermod -G sudo $IMTL_USER
RUN echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
USER $IMTL_USER

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
# Clone and build the xdp-tools project
RUN git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git && \
cd xdp-tools && ./configure && make && sudo make install && \
cd lib/libbpf/src && sudo make install

RUN git clone https://github.com/DPDK/$DPDK_REPO.git && \
# Clone and build DPDK and IMTL
RUN git clone https://github.com/OpenVisualCloud/$MTL_REPO.git && \
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 && \
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 && \
ninja -C build && \
sudo ninja -C build install && \
cd ..

# build mtl
RUN cd $MTL_REPO && \
./build.sh && \
cd ..
cd ../$MTL_REPO && ./build.sh

CMD ["/bin/bash"]
17 changes: 10 additions & 7 deletions manager/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# First stage: build environment
FROM ubuntu:22.04 AS build-env
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2023 Intel Corporation

# Build stage, ubuntu 22.04
FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37 as builder

LABEL maintainer="[email protected]"

Expand All @@ -18,18 +21,18 @@ RUN git clone --recurse-submodules https://github.com/xdp-project/xdp-tools.git
RUN git clone https://github.com/OpenVisualCloud/Media-Transport-Library.git && \
cd Media-Transport-Library/manager && meson setup build && meson compile -C build

# Second stage: runtime environment
FROM ubuntu:22.04
# Runtime stage, ubuntu 22.04
FROM ubuntu@sha256:149d67e29f765f4db62aa52161009e99e389544e25a8f43c8c89d4a445a7ca37

# Install runtime dependencies
RUN apt-get update -y && \
apt-get install -y ethtool libelf-dev && \
apt-get clean && \
rm -rf /var/lib/apt/lists/*

# Copy the necessary binaries and libraries from the build-env
COPY --from=build-env /usr/local /usr/local
COPY --from=build-env /Media-Transport-Library/manager/build /app
# Copy the necessary binaries and libraries from the builder
COPY --from=builder /usr/local /usr/local
COPY --from=builder /Media-Transport-Library/manager/build /app

WORKDIR /app

Expand Down

0 comments on commit 27e7e22

Please sign in to comment.