ci(fedora41): split install prerequisites and build RVM into separate phases

It improves parallelization and speeds up the build by reusing cached layers.
This commit is contained in:
Alex Turbov 2025-01-29 19:03:06 +04:00 committed by Brad King
parent 59383f6509
commit 264c902403
2 changed files with 15 additions and 6 deletions

View File

@ -25,16 +25,27 @@ RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
--mount=type=tmpfs,target=/tmp \
sh /root/install_rust.sh
FROM ${BASE_IMAGE} AS rvm-build
LABEL maintainer="Ben Boeckel <ben.boeckel@kitware.com>"
FROM ${BASE_IMAGE} AS rvm-build-env
LABEL maintainer="Ben Boeckel <ben.boeckel@kitware.com>"
# Pre-install prerequisites for RVM.
RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
--mount=type=bind,source=install_rvm.sh,target=/root/install_rvm.sh \
--mount=type=bind,source=rvm_packages.lst,target=/root/rvm_packages.lst \
--mount=type=cache,from=dnf-cache,source=/var/cache/libdnf5,target=/var/cache/libdnf5,sharing=private \
--mount=type=tmpfs,target=/var/log \
--mount=type=tmpfs,target=/tmp \
sh /root/install_rvm.sh
dnf install -y $(grep '^[^#]\+$' /root/rvm_packages.lst)
FROM rvm-build-env AS rvm-build
LABEL maintainer="Ben Boeckel <ben.boeckel@kitware.com>"
# Build Ruby with RVM.
RUN --mount=type=bind,source=build_rvm.sh,target=/root/build_rvm.sh \
--mount=type=cache,target=/usr/local/rvm/archives \
--mount=type=cache,target=/usr/local/rvm/gem-cache \
--mount=type=cache,target=/usr/local/rvm/src \
--mount=type=tmpfs,target=/tmp \
sh /root/build_rvm.sh
FROM ${BASE_IMAGE} AS iwyu-build-env

View File

@ -2,8 +2,6 @@
set -e
dnf install -y $(grep '^[^#]\+$' /root/rvm_packages.lst)
gpg2 --keyserver hkps://keyserver.ubuntu.com \
--recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 \
7D2BAF1CF37B13E2069D6956105BD0E739499BDB