FROM scratch as base ARG ARCH=x86_64 ENV VERSION=10.43 ENV SRC_HASH=f0048e26b02bdfaf43b8cec75030a9c2fe28552bf5caa693d3ccbf4d886fa930 ENV SRC_FILE=pcre2-${VERSION}.tar.gz ENV SRC_SITE=https://github.com/PCRE2Project/pcre2/archive/refs/tags/${SRC_FILE} FROM base as fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE} FROM fetch as build COPY --from=stagex/zlib . / COPY --from=stagex/gawk . / COPY --from=stagex/bzip2 . / COPY --from=stagex/readline . / COPY --from=stagex/libzstd . / COPY --from=stagex/perl . / COPY --from=stagex/autoconf . / COPY --from=stagex/automake . / COPY --from=stagex/busybox . / COPY --from=stagex/linux-headers . / COPY --from=stagex/musl . / COPY --from=stagex/gcc . / COPY --from=stagex/binutils . / COPY --from=stagex/make . / COPY --from=stagex/libtool . / COPY --from=stagex/m4 . / COPY --from=stagex/libedit . / COPY --from=stagex/ncurses . / RUN tar -xf $SRC_FILE WORKDIR pcre2-pcre2-${VERSION} RUN --network=none <<-EOF set -eux ./autogen.sh ./configure \ CFLAGS="-O3" \ --disable-shared \ --build=${ARCH}-unknown-linux-musl \ --host=${ARCH}-unknown-linux-musl \ --prefix=/usr \ --docdir=/usr/share/doc/pcre2-10.43 \ --htmldir=/usr/share/doc/pcre2-10.43/html \ --enable-pcre2-16 \ --enable-pcre2-32 \ --enable-pcre2grep-libz \ --enable-pcre2test-libedit \ # --enable-jit 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/. /