stagex/packages/gawk/Containerfile
2024-02-15 07:22:38 -08:00

38 lines
975 B
Docker

FROM scratch as base
ARG ARCH=x86_64
ENV VERSION=5.3.0
ENV SRC_HASH=ca9c16d3d11d0ff8c69d79dc0b47267e1329a69b39b799895604ed447d3ca90b
ENV SRC_FILE=gawk-${VERSION}.tar.xz
ENV SRC_SITE=https://ftp.gnu.org/gnu/gawk/${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/musl . /
COPY --from=stagex/make . /
COPY --from=stagex/gcc . /
RUN tar -xf ${SRC_FILE}
WORKDIR gawk-${VERSION}
RUN --network=none <<-EOF
set -ex
./configure \
--build=${ARCH}-linux-musl \
--host=${ARCH}-linux-musl \
--target=${ARCH}-linux-musl \
--prefix=/usr \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-nls \
--disable-pma
make -j "$(nproc)"
EOF
FROM build as install
RUN --network=none make DESTDIR="/rootfs" install
RUN find /rootfs -exec touch -hcd "@0" "{}" +
FROM scratch as package
COPY --from=install /rootfs /