From cc78b291afe0eaba5129b353d8d48bc1fbb8b6af Mon Sep 17 00:00:00 2001 From: "M. Mert Yildiran" Date: Thu, 10 Aug 2023 23:50:53 +0300 Subject: [PATCH] :whale: Bring in `module-loader` Dockerfile --- module-loader/Dockerfile | 33 +++++++++++++++++++++++++++++++++ module-loader/build-push.sh | 5 +++++ 2 files changed, 38 insertions(+) create mode 100644 module-loader/Dockerfile create mode 100755 module-loader/build-push.sh diff --git a/module-loader/Dockerfile b/module-loader/Dockerfile new file mode 100644 index 000000000..1ad29053d --- /dev/null +++ b/module-loader/Dockerfile @@ -0,0 +1,33 @@ +### Builder image +ARG TARGETARCH=amd64 +FROM ${TARGETARCH}/debian:bullseye AS builder + +ARG KERNEL_VERSION + +RUN apt-get update +RUN apt-get install -y -q \ + curl \ + build-essential \ + linux-headers-${KERNEL_VERSION} + +WORKDIR /work +RUN curl https://github.com/ntop/PF_RING/archive/refs/tags/8.4.0.tar.gz -Lo ./pfring.tar.xz && \ + tar -xf pfring.tar.xz && \ + mv ./PF_RING-* ./pfring + +WORKDIR /work/pfring/kernel +ENV KERNELRELEASE=${KERNEL_VERSION} +RUN make + + +### The shipped image +ARG TARGETARCH=amd64 +FROM ${TARGETARCH}/debian:bullseye + +ARG KERNEL_VERSION + +RUN apt-get update && apt-get install -y kmod + +COPY --from=builder /work/pfring/kernel/pf_ring.ko /opt/lib/modules/${KERNEL_VERSION}/ + +RUN depmod -b /opt ${KERNEL_VERSION} diff --git a/module-loader/build-push.sh b/module-loader/build-push.sh new file mode 100755 index 000000000..7073e9a70 --- /dev/null +++ b/module-loader/build-push.sh @@ -0,0 +1,5 @@ +#!/bin/bash +set -e + +# Build it on x86_64 +docker build . -t kubeshark/module-loader:latest --build-arg KERNEL_VERSION="5.10.0-23-amd64" && docker push kubeshark/module-loader:latest