Skip to content

Instantly share code, notes, and snippets.

@pcolazurdo
Last active April 19, 2021 11:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pcolazurdo/c8ffac993cd47a7a06b41e5900ee8a82 to your computer and use it in GitHub Desktop.
Save pcolazurdo/c8ffac993cd47a7a06b41e5900ee8a82 to your computer and use it in GitHub Desktop.
Building ingraind in AL2
cd /local
KERNEL_DIR=$(dirname \
$(dirname \
$(apt list --installed |
grep header | grep generic |
cut -d/ -f1 | while read a
do
find /usr/src/$a/include/ -name generated
done 2>/dev/null ) ) )
KERNEL_VER=$(basename ${KERNEL_DIR})
export KERNEL_VERSION=${KERNEL_VER}
export KERNEL_SOURCE=${KERNEL_DIR}/
export C_INCLUDE_PATH=/usr/include/x86_64-linux-musl/
export CPLUS_INCLUDE_PATH=/usr/include/x86_64-linux-musl/
cargo build --release --target=x86_64-unknown-linux-musl
FROM ubuntu:18.04
ARG openssl_arch=linux-x86_64
ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH \
DEBIAN_FRONTEND=noninteractive
RUN apt-get update \
&& apt-get -y install curl wget lsb-release wget software-properties-common \
&& wget -O /tmp/llvm.sh https://apt.llvm.org/llvm.sh \
&& chmod +x /tmp/llvm.sh \
&& bash -c "/tmp/llvm.sh 11" \
&& apt-get update \
&& apt-get -y install debhelper cmake llvm libllvm11 llvm-11-dev libclang-11-dev \
libelf-dev bison flex libedit-dev clang-format-11 python python-netaddr \
python-pyroute2 luajit libluajit-5.1-dev arping iperf netperf ethtool \
devscripts zlib1g-dev libfl-dev \
pkg-config libssl-dev \
git \
clang \
musl musl-tools musl-dev \
capnproto \
linux-headers-generic \
&& apt-get clean -y
RUN curl https://sh.rustup.rs -sSf > rustup.sh \
&& sh rustup.sh -y \
--default-toolchain stable \
--profile minimal \
--no-modify-path \
&& rustup component add rustfmt \
&& rustup target add x86_64-unknown-linux-musl \
&& rustup toolchain add nightly --profile minimal \
&& rustup --version \
&& cargo --version \
&& rustc --version \
&& cargo install bindgen rsign2
RUN echo "Building OpenSSL" \
&& VERS=1.0.2p \
&& CHECKSUM=50a98e07b1a89eb8f6a99477f262df71c6fa7bef77df4dc83025a2845c827d00 \
&& curl -sqO https://www.openssl.org/source/openssl-$VERS.tar.gz \
&& echo "$CHECKSUM openssl-$VERS.tar.gz" > checksums.txt \
&& sha256sum -c checksums.txt \
&& tar xzf openssl-$VERS.tar.gz && cd openssl-$VERS \
&& CC=musl-gcc ./Configure ${openssl_arch} -fPIC --prefix=/usr/local/musl/$TARGET \
&& make depend \
&& make && make install \
&& cd .. && rm -rf openssl-$VERS.tar.gz openssl-$VERS checksums.txt
ENV OPENSSL_DIR=/usr/local/musl/$TARGET/ \
OPENSSL_INCLUDE_DIR=/usr/local/musl/$TARGET/include/ \
DEP_OPENSSL_INCLUDE=/usr/local/musl/$TARGET/include/ \
OPENSSL_LIB_DIR=/usr/local/musl/$TARGET/lib/ \
OPENSSL_STATIC=1
COPY yum/ /etc/yum/
WORKDIR /build
mkdir ingraind && cd ingraind
git clone https://github.com/ingraind/ingraind.git
cd ingraind
INGRAIND_DIR=$(pwd)
# before next steps, get al2_build_helper.sh from gist
chmod +x al2_build_helper.sh
git clone https://github.com/redsift/ingraind-build.git
cd ingraind-build
# download customized Dockerfile.18.04 from this gist - look at https://github.com/redsift/ingraind-build/issues/2 for more details
docker build --no-cache -f Dockerfile.18.04 -t ingraind_build:18.04 .
cd ${INGRAIND_DIR}
docker run -it --rm -v `pwd`:/local ingraind_build:18.04 bash -c /local/al2_build_helper.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment