FROM scratch as base ARG ARCH=x86_64 ENV VERSION=3.7.4 ENV SRC_HASH=f887755c434a736a609cbd28d87ddbfbe9d6a3bb5b703c22c02f6af80a802735 ENV SRC_FILE=libarchive-${VERSION}.tar.xz ENV SRC_SITE=https://libarchive.org/downloads/${SRC_FILE} FROM base as fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . FROM fetch as build COPY --from=stagex/busybox . / COPY --from=stagex/binutils . / COPY --from=stagex/musl . / COPY --from=stagex/make . / COPY --from=stagex/gcc . / RUN tar -xf ${SRC_FILE} WORKDIR libarchive-${VERSION} RUN --network=none <<-EOF set -ex ./configure \ --build=${ARCH}-linux-musl \ --host=${ARCH}-linux-musl \ --prefix=/usr \ --without-xml2 make -j "$(nproc)" EOF FROM build as install RUN --network=none make DESTDIR="/rootfs" install FROM stagex/filesystem as package COPY --from=install /rootfs/. /