shallow clone to save space in CI (#1987)

* shallow clone

* also remove source dir after building in CI

* formatting

* pass them through?

* only CI

* add as variable
This commit is contained in:
Marc
2025-11-18 08:48:06 +01:00
committed by GitHub
parent eeb7d1a0c4
commit 853cb67e95
4 changed files with 22 additions and 2 deletions

View File

@@ -201,10 +201,15 @@ if [ -f ../cache_key ] && [ "$(cat ../cache_key)" = "${cache_key}" ] && [ -f "bu
else
${spcCommand} doctor --auto-fix
# shellcheck disable=SC2086
${spcCommand} download --with-php="${PHP_VERSION}" --for-extensions="${PHP_EXTENSIONS}" --for-libs="${PHP_EXTENSION_LIBS}" ${SPC_OPT_DOWNLOAD_ARGS}
${spcCommand} download --with-php="${PHP_VERSION}" --shallow-clone --for-extensions="${PHP_EXTENSIONS}" --for-libs="${PHP_EXTENSION_LIBS}" ${SPC_OPT_DOWNLOAD_ARGS}
# shellcheck disable=SC2086
${spcCommand} build --enable-zts --build-embed ${SPC_OPT_BUILD_ARGS} "${PHP_EXTENSIONS}" --with-libs="${PHP_EXTENSION_LIBS}"
if [ -n "$CI" ]; then
rm -rf ./downloads
rm -rf ./source
fi
echo -n "${cache_key}" >../cache_key
fi

View File

@@ -24,6 +24,11 @@ variable "CACHE" {
default = ""
}
variable "CI" {
# CI flag coming from the environment or --set; empty by default
default = ""
}
variable DEFAULT_PHP_VERSION {
default = "8.4"
}
@@ -141,6 +146,7 @@ target "static-builder-musl" {
}
args = {
FRANKENPHP_VERSION = VERSION
CI = CI
}
secret = ["id=github-token,env=GITHUB_TOKEN"]
}
@@ -165,6 +171,7 @@ target "static-builder-gnu" {
args = {
FRANKENPHP_VERSION = VERSION
GO_VERSION = GO_VERSION
CI = CI
}
secret = ["id=github-token,env=GITHUB_TOKEN"]
}

View File

@@ -29,7 +29,12 @@ ENV GOTOOLCHAIN=local
SHELL ["/bin/bash", "-o", "pipefail", "-c"]
# labels, same as static-builder-musl.Dockerfile
# Pass through CI environment flag so build-static.sh can detect CI context
ARG CI
ENV CI=${CI}
# labels, same as static-builder.Dockerfile
LABEL org.opencontainers.image.title=FrankenPHP
LABEL org.opencontainers.image.description="The modern PHP app server"
LABEL org.opencontainers.image.url=https://frankenphp.dev

View File

@@ -25,6 +25,9 @@ ENV GOTOOLCHAIN=local
SHELL ["/bin/ash", "-eo", "pipefail", "-c"]
ARG CI
ENV CI=${CI}
LABEL org.opencontainers.image.title=FrankenPHP
LABEL org.opencontainers.image.description="The modern PHP app server"
LABEL org.opencontainers.image.url=https://frankenphp.dev