mirror of
https://github.com/linuxkit/linuxkit.git
synced 2026-04-11 19:49:28 +00:00
24 lines
630 B
Docker
24 lines
630 B
Docker
# This Dockerfile extracts the kernel headers from the kernel image
|
|
# and then compiles a simple hello world kernel module against them.
|
|
# In the last stage, it creates a package, which can be used for
|
|
# testing.
|
|
|
|
FROM linuxkit/kernel:5.4.39 AS ksrc
|
|
|
|
# Extract headers and compile module
|
|
FROM linuxkit/alpine:e2391e0b164c57db9f6c4ae110ee84f766edc430 AS build
|
|
RUN apk add build-base elfutils-dev
|
|
|
|
COPY --from=ksrc /kernel-dev.tar /
|
|
RUN tar xf kernel-dev.tar
|
|
|
|
WORKDIR /kmod
|
|
COPY ./src/* ./
|
|
RUN make all
|
|
|
|
# Package
|
|
FROM alpine:3.11
|
|
COPY --from=build /kmod/hello_world.ko /
|
|
COPY check.sh /check.sh
|
|
ENTRYPOINT ["/bin/sh", "/check.sh"]
|