FROM scratch as base ARG ARCH=x86_64 ENV VERSION=1.0.8 ENV SRC_HASH=ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269 ENV SRC_FILE=bzip2-${VERSION}.tar.gz ENV SRC_SITE=https://sourceware.org/pub/bzip2/${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 bzip2-${VERSION} RUN --network=none <<-EOF set -ex make -f Makefile-libbz2_so all make all EOF FROM build as install RUN --network=none <<-EOF make PREFIX="/rootfs/usr" install find /rootfs -exec touch -hcd "@0" "{}" + EOF FROM stagex/filesystem as package COPY --from=install /rootfs/. /