This commit is contained in:
Anton Livaja 2024-02-11 01:08:00 -05:00
parent 6eb145ca0e
commit 3dae2e09ed
No known key found for this signature in database
GPG key ID: 44A86CFF1FDF0E85
2 changed files with 68 additions and 0 deletions

View file

@ -194,6 +194,17 @@ out/gettext/index.json: \
out/libxml2/index.json
$(call build,core,gettext)
PHONY: git
git: out/git/index.json
out/git/index.json: \
src/tools/git/Containerfile \
binutils \
busybox \
gcc \
make \
musl
$(call build,tools,git)
.PHONY: go
go: out/go/index.json
out/go/index.json: \

View file

@ -0,0 +1,57 @@
FROM scratch as base
ENV SRC_VERSION=2.9.5
ENV SRC_HASH=a4bea37ecb9a3fb5c0c8ef18c2f7eeaf8ccbcfec91f72f3bccfc6bf72a3e3902
ENV SRC_FILE=git-${SRC_VERSION}.tar.xz
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=busybox . /
COPY --from=musl . /
COPY --from=gcc . /
COPY --from=binutils . /
COPY --from=make . /
COPY --from=zlib . /
COPY --from=perl . /
COPY --from=gettext . /
RUN tar -xvf $SRC_FILE
WORKDIR git-${SRC_VERSION}
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
FROM base as test
COPY --from=install /rootfs /
COPY --from=zlib . /
COPY --from=musl . /
COPY --from=busybox . /
RUN /bin/sh <<-EOF
set -eux
EXPECTED_GIT_VERSION="git version ${SRC_VERSION}"
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 /