From c1cd0a701842b0025ac271fdf29f63ffaa82a706 Mon Sep 17 00:00:00 2001 From: Tsiry Sandratraina Date: Sat, 8 Nov 2025 14:20:07 +0300 Subject: [PATCH] refactor: streamline Dockerfile by consolidating build steps and improving layer caching --- Dockerfile | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/Dockerfile b/Dockerfile index 6f72cc1..f8a5529 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,8 +1,19 @@ -FROM denoland/deno:latest +FROM denoland/deno:latest AS builder -RUN apt-get update +WORKDIR /app + +# Copy only the files needed for installing dependencies +COPY deno.json deno.lock ./ + +RUN deno install + +COPY . . + +RUN deno compile -A -o vmlinux-builder ./build.ts -RUN apt-get install -y \ +FROM ubuntu:latest + +RUN apt-get update && apt-get install -y \ git \ build-essential \ flex \ @@ -12,20 +23,9 @@ RUN apt-get install -y \ gcc \ bc \ libelf-dev \ - pahole - -WORKDIR /app - -COPY deno.json deno.json - -COPY deno.lock deno.lock - -RUN deno install - -COPY . . - -RUN deno compile -A -o vmlinux-builder ./build.ts + pahole \ + && rm -rf /var/lib/apt/lists/* -RUN mv vmlinux-builder /usr/local/bin/vmlinux-builder +COPY --from=builder /app/vmlinux-builder /usr/local/bin/vmlinux-builder ENTRYPOINT ["vmlinux-builder"] \ No newline at end of file -- 2.51.2