From 9cb198a64a564fb3a2699532771f873b1306484a Mon Sep 17 00:00:00 2001 From: TheCodeLamp <12064217+TheCodeLamp@users.noreply.github.com> Date: Sun, 13 Sep 2026 10:38:18 +0200 Subject: [PATCH] Split Containerfile --- Containerfile | 96 ------------------------------------------- Containerfile.base | 23 +++++++++++ Containerfile.desktop | 33 +++++++++++++++ Containerfile.laptop | 47 +++++++++++++++++++++ build.sh | 2 +- 5 files changed, 104 insertions(+), 97 deletions(-) delete mode 100644 Containerfile create mode 100644 Containerfile.base create mode 100644 Containerfile.desktop create mode 100644 Containerfile.laptop diff --git a/Containerfile b/Containerfile deleted file mode 100644 index 5eadc78..0000000 --- a/Containerfile +++ /dev/null @@ -1,96 +0,0 @@ -FROM scratch as ctx -COPY build_scripts / - -FROM ghcr.io/nushell/nushell:latest-alpine as nushell - -FROM quay.io/fedora/fedora-bootc:44 as base - -COPY --from=nushell /usr/bin/nu /usr/bin/nu -RUN printf '/bin/nu\n/usr/bin/nu' >> /etc/shells - -COPY yum-repos/custom.repo /etc/yum.repos.d/custom.repo - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - --mount=type=cache,dst=/var/cache \ - --mount=type=cache,dst=/var/lib/dnf \ - --mount=type=tmpfs,dst=/var/log \ - --mount=type=tmpfs,dst=/tmp \ - /ctx/install-base.sh - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - /ctx/clean-base.sh - -RUN bootc container lint - - -FROM quay.io/fedora/fedora-kinoite:44 as desktop - -COPY --from=nushell /usr/bin/nu /usr/bin/nu -RUN printf '/bin/nu\n/usr/bin/nu\n' >> /etc/shells - -COPY yum-repos/custom.repo /etc/yum.repos.d/custom.repo - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - --mount=type=cache,dst=/var/cache \ - --mount=type=cache,dst=/var/lib/dnf \ - --mount=type=tmpfs,dst=/var/log \ - --mount=type=tmpfs,dst=/tmp \ - /ctx/install-base.sh - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - /ctx/clean-base.sh - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - --mount=type=cache,dst=/var/cache \ - --mount=type=cache,dst=/var/lib/dnf \ - --mount=type=tmpfs,dst=/var/log \ - --mount=type=tmpfs,dst=/tmp \ - /ctx/install-desktop.sh - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - /ctx/clean-desktop.sh - -RUN bootc container lint - - -FROM quay.io/fedora/fedora-kinoite:43 as laptop - -COPY dracut.conf /usr/lib/dracut/dracut.conf.d/50-custom-ostree.conf - -COPY --from=nushell /usr/bin/nu /usr/bin/nu -RUN printf '/bin/nu\n/usr/bin/nu\n' >> /etc/shells - -COPY yum-repos/custom.repo /etc/yum.repos.d/custom.repo - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - --mount=type=cache,dst=/var/cache \ - --mount=type=cache,dst=/var/lib/dnf \ - --mount=type=tmpfs,dst=/var/log \ - --mount=type=tmpfs,dst=/tmp \ - /ctx/install-base.sh - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - /ctx/clean-base.sh - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - --mount=type=cache,dst=/var/cache \ - --mount=type=cache,dst=/var/lib/dnf \ - --mount=type=tmpfs,dst=/var/log \ - --mount=type=tmpfs,dst=/tmp \ - /ctx/install-desktop.sh - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - /ctx/clean-desktop.sh - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - --mount=type=cache,dst=/var/cache \ - --mount=type=cache,dst=/var/lib/dnf \ - --mount=type=cache,dst=/var/lib/rpm-state \ - --mount=type=tmpfs,dst=/var/log \ - --mount=type=tmpfs,dst=/tmp \ - /ctx/install-laptop.sh - -RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ - /ctx/clean-laptop.sh - -RUN bootc container lint diff --git a/Containerfile.base b/Containerfile.base new file mode 100644 index 0000000..37002c9 --- /dev/null +++ b/Containerfile.base @@ -0,0 +1,23 @@ +FROM scratch as ctx +COPY build_scripts / + +FROM ghcr.io/nushell/nushell:latest-alpine as nushell + +FROM quay.io/fedora/fedora-bootc:44 as base + +COPY --from=nushell /usr/bin/nu /usr/bin/nu +RUN printf '/bin/nu\n/usr/bin/nu' >> /etc/shells + +COPY yum-repos/custom.repo /etc/yum.repos.d/custom.repo + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + --mount=type=cache,dst=/var/cache \ + --mount=type=cache,dst=/var/lib/dnf \ + --mount=type=tmpfs,dst=/var/log \ + --mount=type=tmpfs,dst=/tmp \ + /ctx/install-base.sh + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + /ctx/clean-base.sh + +RUN bootc container lint diff --git a/Containerfile.desktop b/Containerfile.desktop new file mode 100644 index 0000000..7ed26db --- /dev/null +++ b/Containerfile.desktop @@ -0,0 +1,33 @@ +FROM scratch as ctx +COPY build_scripts / + +FROM ghcr.io/nushell/nushell:latest-alpine as nushell + +FROM quay.io/fedora/fedora-kinoite:44 as desktop + +COPY --from=nushell /usr/bin/nu /usr/bin/nu +RUN printf '/bin/nu\n/usr/bin/nu\n' >> /etc/shells + +COPY yum-repos/custom.repo /etc/yum.repos.d/custom.repo + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + --mount=type=cache,dst=/var/cache \ + --mount=type=cache,dst=/var/lib/dnf \ + --mount=type=tmpfs,dst=/var/log \ + --mount=type=tmpfs,dst=/tmp \ + /ctx/install-base.sh + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + /ctx/clean-base.sh + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + --mount=type=cache,dst=/var/cache \ + --mount=type=cache,dst=/var/lib/dnf \ + --mount=type=tmpfs,dst=/var/log \ + --mount=type=tmpfs,dst=/tmp \ + /ctx/install-desktop.sh + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + /ctx/clean-desktop.sh + +RUN bootc container lint diff --git a/Containerfile.laptop b/Containerfile.laptop new file mode 100644 index 0000000..f20cb60 --- /dev/null +++ b/Containerfile.laptop @@ -0,0 +1,47 @@ +FROM scratch as ctx +COPY build_scripts / + +FROM ghcr.io/nushell/nushell:latest-alpine as nushell + +FROM quay.io/fedora/fedora-kinoite:43 as laptop + +COPY dracut.conf /usr/lib/dracut/dracut.conf.d/50-custom-ostree.conf + +COPY --from=nushell /usr/bin/nu /usr/bin/nu +RUN printf '/bin/nu\n/usr/bin/nu\n' >> /etc/shells + +COPY yum-repos/custom.repo /etc/yum.repos.d/custom.repo + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + --mount=type=cache,dst=/var/cache \ + --mount=type=cache,dst=/var/lib/dnf \ + --mount=type=tmpfs,dst=/var/log \ + --mount=type=tmpfs,dst=/tmp \ + /ctx/install-base.sh + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + /ctx/clean-base.sh + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + --mount=type=cache,dst=/var/cache \ + --mount=type=cache,dst=/var/lib/dnf \ + --mount=type=tmpfs,dst=/var/log \ + --mount=type=tmpfs,dst=/tmp \ + /ctx/install-desktop.sh + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + /ctx/clean-desktop.sh + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + --mount=type=cache,dst=/var/cache \ + --mount=type=cache,dst=/var/lib/dnf \ + --mount=type=cache,dst=/var/lib/rpm-state \ + --mount=type=tmpfs,dst=/var/log \ + --mount=type=tmpfs,dst=/tmp \ + /ctx/install-laptop.sh + +RUN --mount=type=bind,from=ctx,source=/,target=/ctx \ + /ctx/clean-laptop.sh + +RUN bootc container lint + diff --git a/build.sh b/build.sh index fc25579..692778b 100755 --- a/build.sh +++ b/build.sh @@ -12,7 +12,7 @@ TIMESTAMP=$(date -u +%Y%m%d) echo "Building ${VARIANT} variant of ${FULL_IMAGE}" -buildah build --target="${VARIANT}" -t "${FULL_IMAGE}:${VARIANT}" . +buildah build -f "Containerfile.${VARIANT}" --target="${VARIANT}" -t "${FULL_IMAGE}:${VARIANT}" . buildah tag "${FULL_IMAGE}:${VARIANT}" "${FULL_IMAGE}:${VARIANT}-${TIMESTAMP}" echo "Successfully built ${VARIANT} variant with tags:"