diff --git a/build-static.sh b/build-static.sh index 529c3cbba..b7fb17395 100755 --- a/build-static.sh +++ b/build-static.sh @@ -74,12 +74,15 @@ if [ -n "${CLEAN}" ]; then go clean -cache fi +cache_key="${PHP_VERSION}-${PHP_EXTENSIONS}-${PHP_EXTENSION_LIBS}" + # Build libphp if necessary -if [ -f "dist/static-php-cli/buildroot/lib/libphp.a" ]; then +if [ -f dist/cache_key ] && [ "$(cat dist/cache_key)" = "${cache_key}" ] && [ -f "dist/static-php-cli/buildroot/lib/libphp.a" ]; then cd dist/static-php-cli else mkdir -p dist/ cd dist/ + echo -n "${cache_key}" >cache_key if [ -d "static-php-cli/" ]; then cd static-php-cli/ diff --git a/static-builder.Dockerfile b/static-builder.Dockerfile index 269b9bad1..74583a322 100644 --- a/static-builder.Dockerfile +++ b/static-builder.Dockerfile @@ -106,5 +106,4 @@ COPY --link caddy caddy COPY --link internal internal RUN --mount=type=secret,id=github-token GITHUB_TOKEN=$(cat /run/secrets/github-token) ./build-static.sh && \ - rm -Rf dist/static-php-cli/source/* && \ - rm dist/static-php-cli/buildroot/lib/libphp.a + rm -Rf dist/static-php-cli/source/*