stagex/packages/ninja/Containerfile
2024-02-27 11:40:34 -08:00

37 lines
913 B
Docker

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
cp -R /usr/lib64/* /usr/lib/
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
RUN find /rootfs -exec touch -hcd "@0" "{}" +
FROM scratch as package
COPY --from=install /rootfs /