FROM scratch as base ENV VERSION=1.9.0 ENV SRC_HASH=5d7ec75828f8d3fd1a0c2f31b5b0cea780cdfe1031359228c428c1a48bfcd5b9 ENV SRC_FILE=v${VERSION}.tar.gz ENV SRC_SITE=https://github.com/martine/ninja/archive/${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/make . / COPY --from=stagex/python . / COPY --from=stagex/musl . / COPY --from=stagex/gcc . / COPY --from=stagex/openssl . / RUN tar -xf ${SRC_FILE} WORKDIR ninja-${VERSION} ADD *.patch . RUN --network=none <<-EOF set -eux patch -p1 < fix-musl.patch python ./configure.py --bootstrap EOF FROM build as install RUN <<-EOF set -eux mkdir -p /rootfs/usr/bin/ cp ninja /rootfs/usr/bin/ EOF FROM stagex/filesystem as package COPY --from=install /rootfs/. /