ci(fedora41): split install prerequisites and build RBEnv into separate phases
It improves parallelization and speeds up the build by reusing cached layers.
This commit is contained in:
parent
86e96322eb
commit
88c5cf809a
@ -7,6 +7,7 @@ FROM ${BASE_IMAGE} AS dnf-cache
|
|||||||
RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
|
RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
|
||||||
--mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \
|
--mount=type=bind,source=deps_packages.lst,target=/root/deps_packages.lst \
|
||||||
--mount=type=bind,source=iwyu_packages.lst,target=/root/iwyu_packages.lst \
|
--mount=type=bind,source=iwyu_packages.lst,target=/root/iwyu_packages.lst \
|
||||||
|
--mount=type=bind,source=rbenv_packages.lst,target=/root/rbenv_packages.lst \
|
||||||
--mount=type=bind,source=rust_packages.lst,target=/root/rust_packages.lst \
|
--mount=type=bind,source=rust_packages.lst,target=/root/rust_packages.lst \
|
||||||
--mount=type=bind,source=rvm_packages.lst,target=/root/rvm_packages.lst \
|
--mount=type=bind,source=rvm_packages.lst,target=/root/rvm_packages.lst \
|
||||||
--mount=type=tmpfs,target=/var/log \
|
--mount=type=tmpfs,target=/var/log \
|
||||||
@ -48,6 +49,27 @@ RUN --mount=type=bind,source=build_rvm.sh,target=/root/build_rvm.sh \
|
|||||||
sh /root/build_rvm.sh
|
sh /root/build_rvm.sh
|
||||||
|
|
||||||
|
|
||||||
|
FROM ${BASE_IMAGE} AS rbenv
|
||||||
|
# Pre-install prerequisites for `rbenv`.
|
||||||
|
RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \
|
||||||
|
--mount=type=bind,source=rbenv_packages.lst,target=/root/rbenv_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 \
|
||||||
|
dnf install -y $(grep '^[^#]\+$' /root/rbenv_packages.lst)
|
||||||
|
|
||||||
|
|
||||||
|
FROM rbenv AS rbenv-build
|
||||||
|
ENV RBENV_ROOT=/opt/rbenv
|
||||||
|
ENV RBENV_BUILD_ROOT=/root/.cache/rbenv-build
|
||||||
|
ENV RUBY_BUILD_CACHE_PATH=/root/.cache/rbenv
|
||||||
|
# Build Ruby with `rbenv`.
|
||||||
|
RUN --mount=type=cache,target=/root/.cache \
|
||||||
|
--mount=type=bind,source=build_rbenv.sh,target=/root/build_rbenv.sh \
|
||||||
|
--mount=type=tmpfs,target=/tmp \
|
||||||
|
sh /root/build_rbenv.sh
|
||||||
|
|
||||||
|
|
||||||
FROM ${BASE_IMAGE} AS iwyu-build-env
|
FROM ${BASE_IMAGE} AS iwyu-build-env
|
||||||
LABEL maintainer="Kyle Edwards <kyle.edwards@kitware.com>"
|
LABEL maintainer="Kyle Edwards <kyle.edwards@kitware.com>"
|
||||||
# Pre-install prerequisites to build IWYU.
|
# Pre-install prerequisites to build IWYU.
|
||||||
@ -98,3 +120,6 @@ RUN --mount=type=bind,from=rust-build,source=/root,target=/root \
|
|||||||
|
|
||||||
RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \
|
RUN --mount=type=bind,from=rvm-build,source=/root,target=/root \
|
||||||
tar -C /usr/local -xf /root/rvm.tar
|
tar -C /usr/local -xf /root/rvm.tar
|
||||||
|
|
||||||
|
RUN --mount=type=bind,from=rbenv-build,source=/root,target=/root \
|
||||||
|
tar -C / -xf /root/rbenv.tar && rbenv global 3.1.2
|
||||||
|
28
.gitlab/ci/docker/fedora41/build_rbenv.sh
Executable file
28
.gitlab/ci/docker/fedora41/build_rbenv.sh
Executable file
@ -0,0 +1,28 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
echo "gem: --no-document" > ~/.gemrc
|
||||||
|
|
||||||
|
# Ruby rbenv
|
||||||
|
export RUBY_CONFIGURE_OPTS=--disable-install-doc
|
||||||
|
export RUBY_BUILD_CURL_OPTS=-C-
|
||||||
|
rbenv install 3.1.2 -k -s -v
|
||||||
|
|
||||||
|
cat <<EOF >/tmp/exclude.lst
|
||||||
|
*LICENSE*
|
||||||
|
*/doc/*
|
||||||
|
*/man/*
|
||||||
|
*.md
|
||||||
|
BSDL
|
||||||
|
CONTRIBUTING.*
|
||||||
|
COPYING
|
||||||
|
LEGAL
|
||||||
|
PSFL
|
||||||
|
README.rdoc
|
||||||
|
History.rdoc
|
||||||
|
gem_make.out
|
||||||
|
test-unit-*/test
|
||||||
|
rss-*/test
|
||||||
|
EOF
|
||||||
|
tar -cf /root/rbenv.tar --exclude-from=/tmp/exclude.lst ${RBENV_ROOT}
|
@ -11,7 +11,3 @@ done
|
|||||||
|
|
||||||
# Remove some other packages tests
|
# Remove some other packages tests
|
||||||
find /usr/lib64/python3.13/site-packages/breezy -type d -a -name tests -exec rm -rf {} +
|
find /usr/lib64/python3.13/site-packages/breezy -type d -a -name tests -exec rm -rf {} +
|
||||||
|
|
||||||
# Ruby rbenv
|
|
||||||
rbenv install 3.1.2
|
|
||||||
rbenv global 3.1.2
|
|
||||||
|
18
.gitlab/ci/docker/fedora41/rbenv_packages.lst
Normal file
18
.gitlab/ci/docker/fedora41/rbenv_packages.lst
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
rbenv
|
||||||
|
ruby-build-rbenv
|
||||||
|
|
||||||
|
# Packages needed for `rbenv`
|
||||||
|
# https://github.com/rbenv/ruby-build/wiki#fedora
|
||||||
|
autoconf
|
||||||
|
bzip2
|
||||||
|
gcc
|
||||||
|
gdbm-devel
|
||||||
|
libffi-devel
|
||||||
|
libyaml-devel
|
||||||
|
make
|
||||||
|
ncurses-devel
|
||||||
|
openssl-devel
|
||||||
|
patch
|
||||||
|
readline-devel
|
||||||
|
rust
|
||||||
|
zlib-devel
|
Loading…
Reference in New Issue
Block a user