FROM scratch as base ENV VERSION=4.9 ENV SRC_HASH=6e226b732e1cd739464ad6862bd1a1aba42d7982922da7a53519631d24975181 ENV SRC_FILE=sed-${VERSION}.tar.xz ENV SRC_SITE=https://ftp.gnu.org/gnu/sed/${SRC_FILE} FROM base as fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . FROM fetch as build COPY --from=stagex/busybox . / COPY --from=stagex/gcc . / COPY --from=stagex/binutils . / COPY --from=stagex/make . / COPY --from=stagex/musl . / RUN tar -xf sed-${VERSION}.tar.xz WORKDIR sed-${VERSION} RUN --network=none <<-EOF set -eux ./configure \ --prefix=/usr; \ make -j "$(nproc)" EOF FROM build as install RUN make DESTDIR=/rootfs install RUN find /rootfs -exec touch -hcd "@0" "{}" + FROM stagex/filesystem as package COPY --from=install /rootfs/. /