This repository has been archived by the owner on Jul 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add docker build files of 4 linux distros
The intention of these docker files is to run build test before send PR and to solve build failure issues derived from less common distros. Docker version 20 is required to build images correctly. In docker version 19, when some conditions related to kernel and glibc versions are satisfied, `[' command fails during building docker images. Because `faccessat2' syscall is not whitelisted. References https://bugzilla.redhat.com/show_bug.cgi?id=1900021 https://github.com/moby/moby/pull/41353/files
- Loading branch information
Showing
7 changed files
with
108 additions
and
0 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,12 @@ | ||
FROM alpine:20210212 | ||
RUN apk update && apk add llvm11-dev clang-dev build-base zlib-dev curl clang-static llvm-static libxml2-dev linux-headers | ||
ENV CARGO_HOME /usr/local | ||
ENV RUSTUP_HOME /usr/local | ||
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y | ||
ARG KERNEL_HEADERS_TAR | ||
ADD $KERNEL_HEADERS_TAR / | ||
ARG REDBPF_TAR | ||
ADD $REDBPF_TAR / | ||
WORKDIR /redbpf | ||
ENV RUSTFLAGS -Ctarget-feature=-crt-static | ||
CMD cargo build |
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,11 @@ | ||
FROM archlinux:base-devel-20210321.0.17674 | ||
RUN pacman -Sy --noconfirm llvm clang zlib | ||
ENV CARGO_HOME /usr/local | ||
ENV RUSTUP_HOME /usr/local | ||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y | ||
ARG KERNEL_HEADERS_TAR | ||
ADD $KERNEL_HEADERS_TAR / | ||
ARG REDBPF_TAR | ||
ADD $REDBPF_TAR / | ||
WORKDIR /redbpf | ||
CMD cargo build |
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,11 @@ | ||
FROM fedora:rawhide | ||
RUN yum update -y && yum install -y clang llvm-devel zlib-devel | ||
ENV CARGO_HOME /usr/local | ||
ENV RUSTUP_HOME /usr/local | ||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y | ||
ARG KERNEL_HEADERS_TAR | ||
ADD $KERNEL_HEADERS_TAR / | ||
ARG REDBPF_TAR | ||
ADD $REDBPF_TAR / | ||
WORKDIR /redbpf | ||
CMD cargo build |
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,11 @@ | ||
FROM ubuntu:groovy | ||
RUN apt update && apt install -y build-essential zlib1g-dev llvm-11-dev libclang-11-dev curl | ||
ENV CARGO_HOME /usr/local | ||
ENV RUSTUP_HOME /usr/local | ||
RUN curl https://sh.rustup.rs -sSf | bash -s -- -y | ||
ARG KERNEL_HEADERS_TAR | ||
ADD $KERNEL_HEADERS_TAR / | ||
ARG REDBPF_TAR | ||
ADD $REDBPF_TAR / | ||
WORKDIR /redbpf | ||
CMD cargo build |
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,43 @@ | ||
#!/bin/bash | ||
|
||
DISTRO=$1 | ||
case $DISTRO in | ||
fedora-35|ubuntu-20.10|arch-20210321|alpine-20210212) | ||
;; | ||
*) | ||
echo "error: unknown distro. choose one of <ubuntu-20.10|fedora-35|arch-20210321>" >&2 | ||
exit 1 | ||
;; | ||
esac | ||
|
||
if [[ -z $KERNEL_SOURCE ]]; then | ||
KERNEL_SOURCE=/lib/modules/$(uname -r) | ||
fi | ||
|
||
if ! [[ -e $KERNEL_SOURCE ]]; then | ||
echo "error: kernel headers not found" >&2 | ||
exit 1 | ||
fi | ||
|
||
BINDIR=$(readlink -f $(dirname $0)) | ||
cd $BINDIR | ||
ROOTDIR=$(git rev-parse --show-toplevel) | ||
cd $ROOTDIR | ||
UNIQUE=$(tr -dc '[:alnum:]' < /dev/urandom |head -c 16) | ||
TEMPDIR=$(mktemp -p $ROOTDIR -d) | ||
git archive --prefix=redbpf/ --format=tar -o $TEMPDIR/$UNIQUE.tar HEAD | ||
while read SM_TAR; do | ||
tar -Af $TEMPDIR/${UNIQUE}.tar ${SM_TAR} | ||
rm -f ${SM_TAR} | ||
done < <(git submodule foreach -q \ | ||
"git archive --prefix=redbpf/\$sm_path/ --format=tar -o ${UNIQUE}.tar HEAD; echo \$sm_path/${UNIQUE}.tar") | ||
cd $TEMPDIR | ||
KERNEL_HEADERS_TAR=$(uname -r).tar | ||
tar -hcf $KERNEL_HEADERS_TAR $KERNEL_SOURCE | ||
|
||
cp $BINDIR/Dockerfile-${DISTRO} Dockerfile | ||
docker build -t redbpf-build-env:${DISTRO} \ | ||
--build-arg REDBPF_TAR=${UNIQUE}.tar \ | ||
--build-arg KERNEL_HEADERS_TAR=${KERNEL_HEADERS_TAR} . | ||
|
||
rm -rf ${TEMPDIR:?} |
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,10 @@ | ||
#!/bin/bash | ||
|
||
BINDIR=$(dirname $(readlink -f $0)) | ||
cd $BINDIR | ||
for DISTRO in fedora-35 ubuntu-20.10 arch-20210321 alpine-20210212; do | ||
./build-image.sh $DISTRO | ||
done | ||
|
||
# Make a machine sounds like a jet or melt CPUs.. | ||
docker-compose up |
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,10 @@ | ||
version: "3" | ||
services: | ||
fedora-35: | ||
image: redbpf-build-env:fedora-35 | ||
ubuntu-20.10: | ||
image: redbpf-build-env:ubuntu-20.10 | ||
arch-20210321: | ||
image: redbpf-build-env:arch-20210321 | ||
alpine-20210212: | ||
image: redbpf-build-env:alpine-20210212 |