FROM scratch AS base ARG ARCH=x86_64 ENV VERSION=0.9.31 ENV SRC_HASH=f7aecdd1bcc69fb32bb33d8544cfe50f8e9e916f366d598a268e1f43ee9c7603 ENV SRC_FILE=openldap-LMDB_${VERSION}.tar.gz ENV SRC_SITE=https://git.openldap.org/openldap/openldap/-/archive/LMDB_${VERSION}/${SRC_FILE} FROM base AS fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE} FROM fetch AS build COPY --from=stagex/musl . / COPY --from=stagex/gcc . / COPY --from=stagex/bash . / COPY --from=stagex/busybox . / COPY --from=stagex/binutils . / COPY --from=stagex/make . / COPY --from=stagex/openssl . / RUN tar -xf ${SRC_FILE} WORKDIR openldap-LMDB_${VERSION}/libraries/liblmdb COPY *.patch . RUN --network=none <<-EOF set -eux \ patch -p1 lmdb-make.patch export CFLAGS="-O2 -fPIC" make 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/. /