FROM scratch as base ENV VERSION=2.15 ENV SRC_HASH=efa50ef983137eefc0a02fdb51509d624b5e3295c980aa127ceee4183455499e ENV SRC_FILE=cpio-${VERSION}.tar.gz ENV SRC_SITE=https://ftp.gnu.org/gnu/cpio/${SRC_FILE} FROM base as fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . FROM fetch as build COPY --from=busybox . / COPY --from=gcc . / COPY --from=binutils . / COPY --from=make . / COPY --from=musl . / RUN tar -xzf ${SRC_FILE} WORKDIR cpio-${VERSION} RUN --network=none <<-EOF set -eux ./configure \ --build=x86_64-unknown-linux-musl \ --host=x86_64-unknown-linux-musl \ --prefix=/usr \ --bindir=/bin \ --mandir=/usr/share/man \ --infodir=/usr/share/info make EOF FROM build as install RUN <<-EOF set -eux make DESTDIR=/rootfs install EOF RUN find /rootfs -exec touch -hcd "@0" "{}" + FROM scratch as package COPY --from=install /rootfs /