stagex/packages/git/Containerfile

61 lines
1.5 KiB
Text
Raw Normal View History

2024-08-08 07:47:42 +00:00
FROM scratch AS base
ENV VERSION=2.9.5
2024-02-11 06:08:00 +00:00
ENV SRC_HASH=a4bea37ecb9a3fb5c0c8ef18c2f7eeaf8ccbcfec91f72f3bccfc6bf72a3e3902
ENV SRC_FILE=git-${VERSION}.tar.xz
2024-02-11 06:08:00 +00:00
ENV SRC_SITE=http://mirrors.edge.kernel.org/pub/software/scm/git/${SRC_FILE}
2024-08-08 07:47:42 +00:00
FROM base AS fetch
2024-02-11 06:08:00 +00:00
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
2024-08-08 07:47:42 +00:00
FROM fetch AS build
COPY --from=stagex/busybox . /
COPY --from=stagex/musl . /
COPY --from=stagex/gcc . /
2024-04-16 22:38:49 +00:00
COPY --from=stagex/curl . /
COPY --from=stagex/openssl . /
COPY --from=stagex/binutils . /
COPY --from=stagex/make . /
COPY --from=stagex/zlib . /
COPY --from=stagex/perl . /
COPY --from=stagex/gettext . /
2024-02-11 06:08:00 +00:00
RUN tar -xvf $SRC_FILE
2024-08-26 01:18:52 +00:00
WORKDIR /git-${VERSION}
2024-02-14 22:48:50 +00:00
ENV SOURCE_DATE_EPOCH=1
2024-02-11 06:08:00 +00:00
RUN --network=none <<-EOF
set -eux
./configure \
--build=x86_64-unknown-linux-musl \
--host=x86_64-unknown-linux-musl \
--prefix=/usr \
--bindir=/usr/bin \
2024-02-11 06:08:00 +00:00
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-nls \
--enable-readline \
--without-curses \
--without-bash-malloc \
--without-tcltk
make -j "$(nproc)"
2024-02-11 06:08:00 +00:00
EOF
2024-08-08 07:47:42 +00:00
FROM build AS install
2024-02-11 06:08:00 +00:00
RUN make DESTDIR=/rootfs install
2024-08-08 07:47:42 +00:00
FROM base AS test
COPY --from=install /rootfs/. /
COPY --from=stagex/zlib . /
COPY --from=stagex/musl . /
COPY --from=stagex/busybox . /
2024-02-11 06:08:00 +00:00
RUN /bin/sh <<-EOF
set -eux
EXPECTED_GIT_VERSION="git version ${VERSION}"
2024-02-11 06:08:00 +00:00
GIT_VERSION=\$(git --version)
if [ "\$GIT_VERSION" != "\$EXPECTED_GIT_VERSION" ]; then
echo "Expected git version is \$EXPECTED_GIT_VERSION, but got \$GIT_VERSION"
exit 1
fi
EOF
2024-08-08 07:47:42 +00:00
FROM stagex/filesystem AS package
COPY --from=install /rootfs/. /