stagex/packages/util-linux/Containerfile
2024-02-17 12:42:53 -08:00

53 lines
1.5 KiB
Docker

FROM scratch as base
ENV VERSION=2.39.3
ENV SRC_HASH=d3315ff701890f4fa1dd38ea387767fcb9e1aaeb763eb904677c03d2a7a5bdc1
ENV SRC_FILE=util-linux-${VERSION}.tar.gz
ENV SRC_SITE=https://codeload.github.com/util-linux/util-linux/legacy.tar.gz/v${VERSION}
FROM base as fetch
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} ${SRC_FILE}
FROM fetch as build
COPY --from=stagex/busybox . /
COPY --from=stagex/musl . /
COPY --from=stagex/gcc . /
COPY --from=stagex/binutils . /
COPY --from=stagex/perl . /
COPY --from=stagex/pkgconf . /
COPY --from=stagex/autoconf . /
COPY --from=stagex/automake . /
COPY --from=stagex/gettext . /
COPY --from=stagex/bison . /
COPY --from=stagex/libtool . /
COPY --from=stagex/linux-headers . /
COPY --from=stagex/m4 . /
COPY --from=stagex/make . /
RUN mkdir util-linux
RUN tar -xvf $SRC_FILE --strip-components=1 -C util-linux
WORKDIR util-linux
RUN --network=none <<-EOF
set -eux
./autogen.sh
./configure \
--build=x86_64-unknown-linux-musl \
--host=x86_64-unknown-linux-musl \
--prefix=/usr \
--disable-nls \
--with-vendordir=/usr/lib \
--enable-fs-paths-extra=/usr/sbin \
--disable-silent-rules \
--disable-gtk-doc \
--enable-newgrp
make
EOF
FROM build as install
RUN <<-EOF
printf "root:x:0:root\ntty:x:5:" >> /etc/group
printf "root:x:0:0:root:/root:/bin/sh" >> /etc/passwd
make DESTDIR=/rootfs install
EOF
RUN find /rootfs -exec touch -hcd "@0" "{}" +
FROM scratch as package
COPY --from=install /rootfs /