stagex/packages/git/Containerfile

60 lines
1.5 KiB
Text
Raw Normal View History

2024-02-11 06:08:00 +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}
FROM base as fetch
ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} .
FROM fetch as build
COPY --from=stagex/busybox . /
COPY --from=stagex/musl . /
COPY --from=stagex/gcc . /
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
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=/bin \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--disable-nls \
--enable-readline \
--without-curses \
--without-bash-malloc \
--without-tcltk
make
EOF
FROM build as install
RUN make DESTDIR=/rootfs install
2024-02-14 13:24:34 +00:00
RUN find /rootfs -exec touch -hcd "@0" "{}" +
2024-02-11 06:08:00 +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
FROM scratch as package
COPY --from=install /rootfs /