Last active
October 18, 2022 03:14
-
-
Save andreybleme/fd62a2a277d0babb619152c9708e8433 to your computer and use it in GitHub Desktop.
Minimal Dockerfile container for running BPF programs using libbpf
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
FROM ubuntu:latest | |
RUN apt-get update && \ | |
apt-get install -y build-essential git cmake \ | |
zlib1g-dev libevent-dev \ | |
libelf-dev llvm \ | |
clang libc6-dev-i386 | |
RUN mkdir /src && \ | |
git init | |
WORKDIR /src | |
# Link asm/byteorder.h into eBPF | |
RUN ln -s /usr/include/x86_64-linux-gnu/asm/ /usr/include/asm | |
# Build libbpf as a static lib | |
RUN git clone https://github.com/libbpf/libbpf-bootstrap.git && \ | |
cd libbpf-bootstrap && \ | |
git submodule update --init --recursive | |
RUN cd libbpf-bootstrap/libbpf/src && \ | |
make BUILD_STATIC_ONLY=y && \ | |
make install BUILD_STATIC_ONLY=y LIBDIR=/usr/lib/x86_64-linux-gnu/ | |
# Clones the linux kernel repo and use the latest linux kernel source BPF headers | |
RUN git clone --depth 1 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git && \ | |
cp linux/include/uapi/linux/bpf* /usr/include/linux/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment