diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 3f29181708f761bd161a032029c5c005465f6f52..8f39f279ced1a965126fb078436a8065bed2fa4b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -12,6 +12,9 @@ workflow: - if: $CI_COMMIT_TAG - if: $CI_COMMIT_REF_PROTECTED == "true" +variables: + STANDALONE_IMAGE: "${CI_REGISTRY_IMAGE}/default:${CI_COMMIT_REF_SLUG}" + test:linux: image: $image stage: test @@ -251,3 +254,38 @@ documentation: - ./ci/install-dependencies.sh script: - ./ci/test-documentation.sh + +build:standalone-git: + stage: build + image: docker:${DOCKER_VERSION} + services: + - docker:${DOCKER_VERSION}-dind + variables: + DOCKER_VERSION: "27.5.0" + DOCKER_HOST: tcp://docker:2375 + DOCKER_TLS_CERTDIR: "" + before_script: + - docker login --username gitlab-ci-token --password "${CI_JOB_TOKEN}" "${CI_REGISTRY}" + script: + - | + docker buildx build \ + --file="contrib/standalone-git/Containerfile" \ + --tag="${STANDALONE_IMAGE}" \ + --push . + after_script: + - docker logout "${CI_REGISTRY}" + +package:standalone-git: + stage: build + image: + name: ${STANDALONE_IMAGE} + #entrypoint: ["sh"] + variables: + TARBALL: git-VERSION.tar.gz + needs: + - build:standalone-git + artifacts: + paths: + - ${TARBALL} + script: + - tar -czf "${TARBALL}" /rootfs/* diff --git a/contrib/standalone-git/Containerfile b/contrib/standalone-git/Containerfile new file mode 100644 index 0000000000000000000000000000000000000000..22ec8e31464505daca2ed637e59c1b5c880eef53 --- /dev/null +++ b/contrib/standalone-git/Containerfile @@ -0,0 +1,51 @@ +FROM scratch AS base +#ENV VERSION=2.48.1 +ENV VERSION=master +ENV SRC_HASH=1c5d545f5dc1eb51e95d2c50d98fdf88b1a36ba1fa30e9ae5d5385c6024f82ad +ENV SRC_FILE=git-${VERSION}.tar.gz +#ENV SRC_SITE=https://mirrors.edge.kernel.org/pub/software/scm/git/${SRC_FILE} +ENV SRC_SITE=https://gitlab.com/gitlab-org/git/-/archive/master/${SRC_FILE} +#https://gitlab.com/gitlab-org/git/-/archive/v2.48.1/git-v2.48.1.tar.gz + +FROM base AS fetch +#ADD --checksum=sha256:${SRC_HASH} ${SRC_SITE} . +ADD ${SRC_SITE} . + +FROM fetch AS build +COPY --from=stagex/core-busybox . / +COPY --from=stagex/core-musl . / +COPY --from=stagex/core-gcc . / +COPY --from=stagex/core-curl . / +COPY --from=stagex/core-openssl . / +COPY --from=stagex/core-binutils . / +COPY --from=stagex/core-python . / +COPY --from=stagex/core-meson . / +COPY --from=stagex/user-ninja . / +COPY --from=stagex/core-pkgconf . / +COPY --from=stagex/core-zlib . / +RUN tar -xvf $SRC_FILE +WORKDIR /git-${VERSION} +ENV SOURCE_DATE_EPOCH=1 +RUN --network=none <<-EOF + set -eux + ARCH="$(uname -m)" + CC="${ARCH}-linux-musl-gcc -static" \ + meson setup build \ + --prefix=/rootfs \ + --prefer-static \ + --buildtype release \ + --libdir lib \ + --strip \ + --wrap-mode nofallback \ + -D pcre2=disabled \ + -D expat=disabled \ + -D perl=disabled \ + -D tests=false \ + -D gitweb=disabled \ + -D python=disabled \ + -D default_library=static + meson install -C build +EOF + +WORKDIR /rootfs +#ENTRYPOINT ["/rootfs/bin/git"]