FROM scratch AS base ENV VERSION=16.2 ENV SRC_HASH=2b8201047ec81acd1bad29dba278d788e7891b9c3e8232eda16bb29dec8131c7 ENV SRC_FILE=postgresql-${VERSION}.tar.gz ENV SRC_SITE=https://ftp.postgresql.org/pub/source/v16.2/${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/musl . / COPY --from=stagex/pkgconf . / COPY --from=stagex/icu . / COPY --from=stagex/llvm . / COPY --from=stagex/zlib . / COPY --from=stagex/gcc . / COPY --from=stagex/clang16 . / COPY --from=stagex/perl . / COPY --from=stagex/ncurses . / COPY --from=stagex/bison . / COPY --from=stagex/flex . / COPY --from=stagex/libxml2 . / COPY --from=stagex/python . / COPY --from=stagex/openssl . / COPY --from=stagex/readline . / COPY --from=stagex/util-linux . / COPY --from=stagex/linux-headers . / COPY --from=stagex/e2fsprogs . / COPY --from=stagex/tcl . / RUN tar -xf ${SRC_FILE} WORKDIR postgresql-${VERSION} RUN --network=none <<-EOF set -eux ./configure \ --build=x86_64-linux-musl \ --host=x86_64-linux-musl \ --prefix=/usr \ --mandir=/usr/share/man \ --with-libxml \ --with-openssl \ --with-uuid=e2fs \ --disable-rpath \ --with-llvm \ --with-perl \ --with-python \ --with-icu \ --with-tcl \ --with-readline make -j "$(nproc)" world EOF FROM build AS install RUN --network=none make install-world DESTDIR=/rootfs FROM stagex/filesystem AS package COPY --from=install /rootfs/. /