* refactor: repurpose build.sh as build preparation It currently does too many things, let's split it up. This needs to be done as we want to move away from a system that copies (also overrides) files from fedora RPMs and then may remove said rpms, resulting in removing our changes, which of course defeats the entire point. A disadvantage this has is that we need to be more mindful and disciplined of when things are needed during the build. Currently we actually do not need any system_files we copy in the stage where we are installing packages/have network access. If we do at some point we will probably either inline files in build-prep.sh or have a 2nd directory with files strictly needed for the build. This is why we can copy all the files to the system after that, just before systemd units get activated, initramfs gets generated, general things we can do offline after we have installed packages are done. Resolves: https://github.com/ublue-os/aurora/issues/2687 * remove useless comment * same treatment for DX * remove unused DX specific version logic We don't use this, we have branches now. * move sysctl before docker install
143 lines
5.4 KiB
Text
143 lines
5.4 KiB
Text
ARG BASE_IMAGE_ORG
|
|
ARG BASE_IMAGE_NAME
|
|
ARG BASE_IMAGE="${BASE_IMAGE_ORG}/${BASE_IMAGE_NAME}"
|
|
ARG FEDORA_MAJOR_VERSION
|
|
ARG AKMODS_FLAVOR
|
|
ARG KERNEL
|
|
ARG COMMON
|
|
ARG BREW
|
|
|
|
FROM ${COMMON} AS common
|
|
FROM ${BREW} AS brew
|
|
|
|
FROM ghcr.io/ublue-os/akmods:${AKMODS_FLAVOR}-${FEDORA_MAJOR_VERSION}-${KERNEL} AS akmods
|
|
|
|
#if defined(NVIDIA)
|
|
FROM ghcr.io/ublue-os/akmods-nvidia-open:${AKMODS_FLAVOR}-${FEDORA_MAJOR_VERSION}-${KERNEL} AS akmods-nvidia-open
|
|
#endif
|
|
|
|
#if defined(ZFS)
|
|
FROM ghcr.io/ublue-os/akmods-zfs:${AKMODS_FLAVOR}-${FEDORA_MAJOR_VERSION}-${KERNEL} AS akmods-zfs
|
|
#endif
|
|
|
|
FROM scratch AS ctx
|
|
COPY /build_scripts /build_scripts
|
|
|
|
# /* https://github.com/get-aurora-dev/common */
|
|
COPY --from=common /logos /system_files/shared
|
|
COPY --from=common /system_files /system_files
|
|
COPY --from=common /wallpapers /system_files/shared
|
|
|
|
# /* https://github.com/ublue-os/brew */
|
|
COPY --from=brew /system_files /system_files/shared
|
|
|
|
COPY /system_files /system_files
|
|
|
|
# /* aurora image section */
|
|
FROM ${BASE_IMAGE}:${FEDORA_MAJOR_VERSION} AS base
|
|
|
|
ARG AKMODS_FLAVOR="main"
|
|
ARG BASE_IMAGE_NAME="${BASE_IMAGE_NAME}"
|
|
ARG FEDORA_MAJOR_VERSION=""
|
|
ARG IMAGE_NAME="aurora"
|
|
ARG IMAGE_VENDOR="ublue-os"
|
|
ARG KERNEL=""
|
|
ARG SHA_HEAD_SHORT=""
|
|
ARG UBLUE_IMAGE_TAG="latest"
|
|
ARG VERSION=""
|
|
ARG IMAGE_FLAVOR=""
|
|
|
|
# /* so ghcurl wrapper is available to all later RUNs */
|
|
ENV PATH="/tmp/scripts/helpers:${PATH}"
|
|
|
|
# /* Install Packages, miscellaneous things that need a network */
|
|
|
|
# /* aurora:latest no zfs or nvidia */
|
|
#if !defined(NVIDIA) && !defined(ZFS)
|
|
RUN --mount=type=tmpfs,dst=/boot \
|
|
--mount=type=tmpfs,dst=/var \
|
|
--mount=type=bind,from=ctx,source=/,target=/ctx \
|
|
--mount=type=cache,dst=/var/cache/libdnf5 \
|
|
--mount=type=bind,from=akmods,src=/kernel-rpms,dst=/tmp/kernel-rpms \
|
|
--mount=type=bind,from=akmods,src=/rpms/common,dst=/tmp/rpms/common \
|
|
--mount=type=bind,from=akmods,src=/rpms/kmods,dst=/tmp/rpms/kmods \
|
|
--mount=type=secret,id=GITHUB_TOKEN \
|
|
/ctx/build_scripts/shared/build-prep.sh && \
|
|
/ctx/build_scripts/base/01-packages.sh && \
|
|
/ctx/build_scripts/base/02-install-common-kernel-akmods.sh && \
|
|
/ctx/build_scripts/base/03-fetch.sh
|
|
#endif
|
|
|
|
# /* aurora:stable with zfs no nvidia */
|
|
#if !defined(NVIDIA) && defined(ZFS)
|
|
RUN --mount=type=tmpfs,dst=/boot \
|
|
--mount=type=tmpfs,dst=/var \
|
|
--mount=type=bind,from=ctx,source=/,target=/ctx \
|
|
--mount=type=cache,dst=/var/cache/libdnf5 \
|
|
--mount=type=bind,from=akmods,src=/kernel-rpms,dst=/tmp/kernel-rpms \
|
|
--mount=type=bind,from=akmods,src=/rpms/common,dst=/tmp/rpms/common \
|
|
--mount=type=bind,from=akmods,src=/rpms/kmods,dst=/tmp/rpms/kmods \
|
|
--mount=type=bind,from=akmods-zfs,src=/rpms/kmods/zfs,dst=/tmp/rpms/kmods/zfs \
|
|
--mount=type=secret,id=GITHUB_TOKEN \
|
|
/ctx/build_scripts/shared/build-prep.sh && \
|
|
/ctx/build_scripts/base/01-packages.sh && \
|
|
/ctx/build_scripts/base/02-install-common-kernel-akmods.sh && \
|
|
/ctx/build_scripts/base/zfs.sh && \
|
|
/ctx/build_scripts/base/03-fetch.sh
|
|
#endif
|
|
|
|
# /* aurora-nvidia-open:latest no zfs */
|
|
#if defined(NVIDIA) && !defined(ZFS)
|
|
RUN --mount=type=tmpfs,dst=/boot \
|
|
--mount=type=tmpfs,dst=/var \
|
|
--mount=type=bind,from=ctx,source=/,target=/ctx \
|
|
--mount=type=cache,dst=/var/cache/libdnf5 \
|
|
--mount=type=bind,from=akmods,src=/kernel-rpms,dst=/tmp/kernel-rpms \
|
|
--mount=type=bind,from=akmods,src=/rpms/common,dst=/tmp/rpms/common \
|
|
--mount=type=bind,from=akmods,src=/rpms/kmods,dst=/tmp/rpms/kmods \
|
|
--mount=type=bind,from=akmods-nvidia-open,src=/rpms,dst=/tmp/rpms/nvidia \
|
|
--mount=type=secret,id=GITHUB_TOKEN \
|
|
/ctx/build_scripts/shared/build-prep.sh && \
|
|
/ctx/build_scripts/base/01-packages.sh && \
|
|
/ctx/build_scripts/base/02-install-common-kernel-akmods.sh && \
|
|
/ctx/build_scripts/base/03-fetch.sh && \
|
|
/ctx/build_scripts/base/04-nvidia.sh
|
|
#endif
|
|
|
|
# /* aurora-nvidia-open:stable with ZFS */
|
|
#if defined(NVIDIA) && defined(ZFS)
|
|
RUN --mount=type=tmpfs,dst=/boot \
|
|
--mount=type=tmpfs,dst=/var \
|
|
--mount=type=bind,from=ctx,source=/,target=/ctx \
|
|
--mount=type=cache,dst=/var/cache/libdnf5 \
|
|
--mount=type=bind,from=akmods,src=/kernel-rpms,dst=/tmp/kernel-rpms \
|
|
--mount=type=bind,from=akmods,src=/rpms/common,dst=/tmp/rpms/common \
|
|
--mount=type=bind,from=akmods,src=/rpms/kmods,dst=/tmp/rpms/kmods \
|
|
--mount=type=bind,from=akmods-nvidia-open,src=/rpms,dst=/tmp/rpms/nvidia \
|
|
--mount=type=bind,from=akmods-zfs,src=/rpms/kmods/zfs,dst=/tmp/rpms/kmods/zfs \
|
|
--mount=type=secret,id=GITHUB_TOKEN \
|
|
/ctx/build_scripts/shared/build-prep.sh && \
|
|
/ctx/build_scripts/base/01-packages.sh && \
|
|
/ctx/build_scripts/base/02-install-common-kernel-akmods.sh && \
|
|
/ctx/build_scripts/base/03-fetch.sh && \
|
|
/ctx/build_scripts/base/04-nvidia.sh && \
|
|
/ctx/build_scripts/base/zfs.sh
|
|
#endif
|
|
|
|
# /* Everything that can be done offline after things are in place should be done here */
|
|
RUN --network=none \
|
|
--mount=type=tmpfs,dst=/boot \
|
|
--mount=type=bind,from=ctx,source=/,target=/ctx \
|
|
/ctx/build_scripts/base/16-override-install.sh && \
|
|
/ctx/build_scripts/base/17-cleanup.sh && \
|
|
/ctx/build_scripts/base/18-image-info.sh && \
|
|
/ctx/build_scripts/base/19-initramfs.sh && \
|
|
/ctx/build_scripts/shared/validate-repos.sh && \
|
|
/ctx/build_scripts/shared/clean-stage.sh && \
|
|
/ctx/build_scripts/shared/chunkah-xattr.sh && \
|
|
/ctx/build_scripts/base/20-tests.sh
|
|
|
|
CMD ["/sbin/init"]
|
|
|
|
RUN --network=none \
|
|
bootc container lint --fatal-warnings --no-truncate
|