File size: 2,536 Bytes
c33a7ce |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
ARG BASEIMAGE="quay.io/centos/centos:stream9"
FROM ${BASEIMAGE}
ARG VENDOR=''
LABEL vendor=${VENDOR}
LABEL org.opencontainers.image.vendor=${VENDOR}
ARG KERNEL_VERSION=''
ARG ENABLE_RT=''
USER root
# The need for the `cp /etc/dnf/dnf.conf` is a workaround for https://github.com/containers/bootc/issues/637
RUN if test -z "${KERNEL_VERSION}" ; then \
echo "The KERNEL_VERSION argument is mandatory. Exiting" ; \
exit 1 ; \
fi \
&& echo "Kernel version: ${KERNEL_VERSION}" \
&& mv /etc/selinux /etc/selinux.tmp \
&& dnf -y install dnf-plugin-config-manager \
&& cp -a /etc/dnf/dnf.conf{,.tmp} && mv /etc/dnf/dnf.conf{.tmp,} \
&& dnf config-manager --best --nodocs --setopt=install_weak_deps=False --save \
&& dnf -y update --exclude kernel* \
&& dnf -y install \
kernel-${KERNEL_VERSION} \
kernel-devel-${KERNEL_VERSION} \
kernel-modules-${KERNEL_VERSION} \
kernel-modules-extra-${KERNEL_VERSION} \
&& if [ "${ENABLE_RT}" ] && [ $(arch) == "x86_64" ]; then \
dnf -y --enablerepo=rt install \
kernel-rt-${KERNEL_VERSION} \
kernel-rt-devel-${KERNEL_VERSION} \
kernel-rt-modules-${KERNEL_VERSION} \
kernel-rt-modules-extra-${KERNEL_VERSION}; \
fi \
&& export INSTALLED_KERNEL=$(rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}" kernel-core-${KERNEL_VERSION}) \
&& export GCC_VERSION=$(cat /lib/modules/${INSTALLED_KERNEL}/config | grep -Eo "gcc \(GCC\) ([0-9\.]+)" | grep -Eo "([0-9\.]+)") \
&& dnf -y install \
binutils \
diffutils \
elfutils-libelf-devel \
jq \
kabi-dw kernel-abi-stablelists \
keyutils \
kmod \
gcc-${GCC_VERSION} \
git \
make \
mokutil \
openssl \
pinentry \
rpm-build \
xz \
&& dnf clean all \
&& mv /etc/selinux.tmp /etc/selinux \
&& useradd -u 1001 -m -s /bin/bash builder
# Last layer for metadata for mapping the driver-toolkit to a specific kernel version
RUN if [ "${KERNEL_VERSION}" == "" ]; then \
export INSTALLED_KERNEL=$(rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}" kernel-core); \
else \
export INSTALLED_KERNEL=$(rpm -q --qf "%{VERSION}-%{RELEASE}.%{ARCH}" kernel-core-${KERNEL_VERSION}) ;\
fi \
&& echo "{ \"KERNEL_VERSION\": \"${INSTALLED_KERNEL}\" }" > /etc/driver-toolkit-release.json \
&& echo -e "KERNEL_VERSION=\"${INSTALLED_KERNEL}\"" > /etc/driver-toolkit-release.sh
USER builder
|