Simple script and config (type-safe) for building custom Linux kernels for Firecracker MicroVMs

refactor: streamline Dockerfile by consolidating build steps and improving layer caching

+17 -17
+17 -17
Dockerfile
··· 1 - FROM denoland/deno:latest 1 + FROM denoland/deno:latest AS builder 2 + 3 + WORKDIR /app 4 + 5 + # Copy only the files needed for installing dependencies 6 + COPY deno.json deno.lock ./ 7 + 8 + RUN deno install 9 + 10 + COPY . . 2 11 3 - RUN apt-get update 12 + RUN deno compile -A -o vmlinux-builder ./build.ts 4 13 5 - RUN apt-get install -y \ 14 + FROM ubuntu:latest 15 + 16 + RUN apt-get update && apt-get install -y \ 6 17 git \ 7 18 build-essential \ 8 19 flex \ ··· 12 23 gcc \ 13 24 bc \ 14 25 libelf-dev \ 15 - pahole 26 + pahole \ 27 + && rm -rf /var/lib/apt/lists/* 16 28 17 - WORKDIR /app 18 - 19 - COPY deno.json deno.json 20 - 21 - COPY deno.lock deno.lock 22 - 23 - RUN deno install 24 - 25 - COPY . . 26 - 27 - RUN deno compile -A -o vmlinux-builder ./build.ts 28 - 29 - RUN mv vmlinux-builder /usr/local/bin/vmlinux-builder 29 + COPY --from=builder /app/vmlinux-builder /usr/local/bin/vmlinux-builder 30 30 31 31 ENTRYPOINT ["vmlinux-builder"]