FROM scratch AS base ENV VERSION=2.69 ENV SRC_HASH=9cc2fa3ee744d881629cdac1a1b54c302e7684fda3e3622056218c7681642ffb ENV SRC_FILE=libcap-${VERSION}.tar.gz ENV SRC_SITE=https://git.kernel.org/pub/scm/libs/libcap/libcap.git/snapshot/${SRC_FILE} FROM base AS fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . FROM fetch AS build COPY --from=stagex/bash . / COPY --from=stagex/binutils . / COPY --from=stagex/busybox . / COPY --from=stagex/linux-headers . / COPY --from=stagex/make . / COPY --from=stagex/musl . / COPY --from=stagex/perl . / COPY --from=stagex/gcc . / RUN tar -xzf ${SRC_FILE} WORKDIR /libcap-${VERSION} RUN --network=none make -j "$(nproc)" lib=lib prefix=/usr GOLANG=no DESTDIR=/rootfs FROM build AS install RUN --network=none make lib=lib prefix=/usr GOLANG=no DESTDIR=/rootfs install FROM scratch AS test COPY --from=install /rootfs / RUN --network=none <<-EOF set -eux getcap --license | grep LICENSE || true setcap -l | grep LICENSE || true getpcaps --license | grep LICENSE || true capsh --license | grep License || true EOF FROM stagex/filesystem AS package COPY --from=install /rootfs /