Source
FROM scratch AS build
ARG VERSION
COPY --from=stagex/core-musl . /
COPY --from=stagex/core-gcc . /
COPY --from=stagex/core-busybox . /
COPY --from=stagex/core-binutils . /
COPY --from=stagex/core-make . /
COPY --from=stagex/core-pkgconf . /
ADD fetch/samurai-${VERSION}.tar.gz .
WORKDIR /samurai-${VERSION}
COPY *.patch .
RUN --network=none <<-EOF
set -eux
patch -p1 CVE-2021-30218.patch
patch -p1 CVE-2021-30219.patch
make CFLAGS="-O2" CC=gcc -j "$(nproc)"
make PREFIX="/usr" DESTDIR=/rootfs install
ln -s samu /rootfs/usr/bin/ninja
EOF
FROM stagex/core-filesystem AS package
COPY --from=build /rootfs/ /