Skip to content

Commit

Permalink
feat(static): better libphp.a cache strategy (#1262)
Browse files Browse the repository at this point in the history
* feat(static): better libphp.a cache strategy

* cs
  • Loading branch information
dunglas authored Dec 18, 2024
1 parent b16b60b commit 20eaecf
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
5 changes: 4 additions & 1 deletion build-static.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
3 changes: 1 addition & 2 deletions static-builder.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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/*

0 comments on commit 20eaecf

Please sign in to comment.