FROM scratch as base ENV VERSION=2.12 ENV SRC_HASH=b30919fa5be280417c17ac561bb1650f60cfb80cc6237fa1e2b6f56154cb9c91 ENV SRC_FILE=grub-${VERSION}.tar.gz ENV SRC_SITE=https://mirrors.kernel.org/gnu/grub/${SRC_FILE} FROM base as fetch ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE} FROM fetch as build COPY --from=stagex/busybox . / COPY --from=stagex/bison . / COPY --from=stagex/flex . / COPY --from=stagex/gcc . / COPY --from=stagex/binutils . / COPY --from=stagex/make . / COPY --from=stagex/gawk . / COPY --from=stagex/musl . / COPY --from=stagex/python . / COPY --from=stagex/m4 . / COPY --from=stagex/perl . / COPY --from=stagex/pkgconf . / COPY --from=stagex/automake . / COPY --from=stagex/autoconf . / COPY --from=stagex/gettext . / COPY --from=stagex/xz . / COPY --from=stagex/linux-headers . / RUN tar -xf ${SRC_FILE} WORKDIR grub-${VERSION} RUN --network=none <<-EOF set -eux sh autogen.sh touch grub-core/extra_deps.lst mkdir build-pc cd build-pc CLFLAGS="-fno-plt" \ ../configure \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --localstatedir=/var \ --build=x86_64 \ --target=x86_64 \ --host=x86_64 \ --disable-nls \ --disable-werror \ --with-platform=pc make cd .. mkdir build-efi cd build-efi ../configure \ --prefix=/usr \ --sysconfdir=/etc \ --mandir=/usr/share/man \ --localstatedir=/var \ --build=x86_64 \ --target=x86_64 \ --host=x86_64 \ --disable-nls \ --disable-werror \ --with-platform=efi \ --disable-efiemu make EOF FROM build as install RUN <<-EOF cd build-pc make DESTDIR=/rootfs install-strip cd .. cd build-efi make DESTDIR=/rootfs install-strip EOF FROM stagex/filesystem as package COPY --from=install /rootfs/. /