# Test the build against the ubuntu:devel kernel config
FROM docker.io/library/ubuntu:devel

RUN export DEBIAN_FRONTEND=noninteractive \
    && apt-get update \
    && apt-get install -y --no-install-recommends \
        wget ca-certificates \
        build-essential \
        linux-headers-generic \
    && rm -rf /var/lib/apt/lists/*

WORKDIR /app

COPY . .

# Create entrypoint script to set up kernel build paths
RUN printf '%s\n' \
    '#!/bin/sh' \
    'KERNEL_BASE_DIR=$(echo /lib/modules/*)' \
    'SYSSRC=$KERNEL_BASE_DIR/build exec "$@"' \
  > /entrypoint.sh && chmod +x /entrypoint.sh
ENTRYPOINT ["/entrypoint.sh"]

CMD ["./buildtest"]
