apiVersion: v1
kind: ConfigMap
metadata:
  name: build-module
data:
  dockerfile: |
    FROM ubuntu:24.04 as builder
    ARG KERNEL_VERSION=''
    RUN apt-get update && \ 
    apt-get -y upgrade && \
    apt-get install -y build-essential && \
    apt-get install -y linux-headers-${KERNEL_VERSION} \
    bc \
    bison \
    flex \
    git \
    libssl-dev \
    libelf-dev \
    python3 \
    wget && \
    rm -rf /var/lib/apt/lists/*
    RUN git clone https://github.com/kubernetes-sigs/kernel-module-management.git
    WORKDIR kernel-module-management/ci/kmm-kmod 
    RUN make 
    
    FROM ubuntu:24.04 
    ARG KERNEL_VERSION
    RUN apt-get -y update && apt-get -y install kmod && \
    rm -rf /var/lib/apt/lists/*
    COPY --from=builder kernel-module-management/ci/kmm-kmod/kmm_ci_a.ko /opt/lib/modules/${KERNEL_VERSION}/
    RUN depmod -b /opt
    
