FROM scratch AS base ENV VERSION=2.39.3 ENV SRC_HASH=d3315ff701890f4fa1dd38ea387767fcb9e1aaeb763eb904677c03d2a7a5bdc1 ENV SRC_FILE=util-linux-${VERSION}.tar.gz ENV SRC_SITE=https://codeload.github.com/util-linux/util-linux/legacy.tar.gz/v${VERSION} FROM base AS fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE} FROM fetch AS build COPY --from=stagex/busybox . / COPY --from=stagex/musl . / COPY --from=stagex/gcc . / COPY --from=stagex/binutils . / COPY --from=stagex/perl . / COPY --from=stagex/pkgconf . / COPY --from=stagex/autoconf . / COPY --from=stagex/automake . / COPY --from=stagex/gettext . / COPY --from=stagex/bison . / COPY --from=stagex/libtool . / COPY --from=stagex/linux-headers . / COPY --from=stagex/m4 . / COPY --from=stagex/make . / RUN mkdir util-linux RUN tar -xvf $SRC_FILE --strip-components=1 -C util-linux WORKDIR util-linux RUN --network=none <<-EOF set -eux ./autogen.sh ./configure \ --build=x86_64-unknown-linux-musl \ --host=x86_64-unknown-linux-musl \ --prefix=/usr \ --exec-prefix=/usr \ --sbindir=/usr/sbin \ --bindir=/usr/bin \ --libdir=/usr/lib \ --with-vendordir=/usr/lib \ --enable-fs-paths-extra=/usr/sbin \ --disable-nls \ --disable-silent-rules \ --disable-gtk-doc \ --enable-newgrp make -j "$(nproc)" EOF FROM build AS install RUN --network=none make DESTDIR=/rootfs install FROM stagex/filesystem AS package COPY --from=install /rootfs/. /