From 6382bb38313ca960f51ce6cf24eb5ac75a87d9d6 Mon Sep 17 00:00:00 2001 From: Kyle Gospodnetich Date: Sat, 22 Mar 2025 15:18:22 -0700 Subject: feat: Avoid copying build files into image, add option for linting (#93) --- Containerfile | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'Containerfile') diff --git a/Containerfile b/Containerfile index 015dfaf..69550ff 100644 --- a/Containerfile +++ b/Containerfile @@ -1,3 +1,8 @@ +# Allow build scripts to be referenced without being copied into the final image +FROM scratch AS ctx +COPY build_files / + +# Base Image FROM ghcr.io/ublue-os/bazzite:stable ## Other possible base images include: @@ -13,11 +18,14 @@ FROM ghcr.io/ublue-os/bazzite:stable ## make modifications desired in your image and install packages by modifying the build.sh script ## the following RUN directive does all the things required to run "build.sh" as recommended. -COPY build.sh /tmp/build.sh - -RUN --mount=type=cache,dst=/var/cache \ +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + --mount=type=cache,dst=/var/cache \ --mount=type=cache,dst=/var/log \ --mount=type=tmpfs,dst=/tmp \ - /tmp/build.sh && \ + /ctx/build.sh && \ ostree container commit +### LINTING +## Verify final image and contents are correct. +## This can be quite sensitive, so it's disabled by default. +# RUN bootc container lint \ No newline at end of file -- cgit v1.2.3