diff --git a/.gitlab/ci/docker/fedora41/Dockerfile b/.gitlab/ci/docker/fedora41/Dockerfile index 25d8e03813..67bcbbc5d3 100644 --- a/.gitlab/ci/docker/fedora41/Dockerfile +++ b/.gitlab/ci/docker/fedora41/Dockerfile @@ -15,16 +15,26 @@ RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \ dnf install --downloadonly -y $(grep -h '^[^#]\+$' /root/*.lst) -FROM ${BASE_IMAGE} AS rust-build +FROM ${BASE_IMAGE} AS rust-build-env LABEL maintainer="Ben Boeckel " - +# Pre-install prerequisites to build Rust projects. RUN --mount=type=bind,source=dnf.conf,target=/etc/dnf/dnf.conf \ - --mount=type=bind,source=install_rust.sh,target=/root/install_rust.sh \ --mount=type=bind,source=rust_packages.lst,target=/root/rust_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_rust.sh + dnf install -y $(grep '^[^#]\+$' /root/rust_packages.lst) + + +FROM rust-build-env AS rust-build +LABEL maintainer="Ben Boeckel " +# Build the needed Rust packages. +# https://doc.rust-lang.org/cargo/guide/cargo-home.html?highlight=.cargo#caching-the-cargo-home-in-ci +RUN --mount=type=bind,source=build_rust.sh,target=/root/build_rust.sh \ + --mount=type=cache,target=/root/.cargo/registry/index \ + --mount=type=cache,target=/root/.cargo/registry/cache \ + --mount=type=tmpfs,target=/tmp \ + sh /root/build_rust.sh FROM ${BASE_IMAGE} AS rvm-build-env diff --git a/.gitlab/ci/docker/fedora41/install_rust.sh b/.gitlab/ci/docker/fedora41/build_rust.sh similarity index 73% rename from .gitlab/ci/docker/fedora41/install_rust.sh rename to .gitlab/ci/docker/fedora41/build_rust.sh index d6d6e43492..f20949b980 100755 --- a/.gitlab/ci/docker/fedora41/install_rust.sh +++ b/.gitlab/ci/docker/fedora41/build_rust.sh @@ -2,9 +2,9 @@ set -e -dnf install -y $(grep '^[^#]\+$' /root/rust_packages.lst) - typos_version=1.29.4 cargo install --root /usr/local --version "$typos_version" typos-cli +strip /usr/local/bin/typos + tar -C /usr/local -cf /root/rust.tar bin/typos