From ea2c7c2895384c25c386f5680c2c996d7737ff1e Mon Sep 17 00:00:00 2001 From: DubbleClick Date: Wed, 1 Nov 2023 15:50:19 +0100 Subject: [PATCH] feat: add ext-ldap and ext-sysvsem to static builder, add PHP_EXTENSION_LIBS to enhance extensions (#203) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * add ldap and sysvsem extension to static-builder * add lib support for static-builder to enhance enabled extensions (such as libjpeg for gd) * disable opcache-jit * include bz2, order alphabetically * Update static.md --------- Co-authored-by: Kévin Dunglas --- docs/static.md | 10 ++++++++++ static-builder.Dockerfile | 5 +++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/docs/static.md b/docs/static.md index 707dbfe4c..bcb6cfce8 100644 --- a/docs/static.md +++ b/docs/static.md @@ -33,6 +33,16 @@ docker buildx bake --load --set static-builder.args.PHP_EXTENSIONS=opcache,pdo_s See [the list of supported extensions](https://static-php.dev/en/guide/extensions.html). +To add libraries enabling additional functionality to the extensions you've enabled, you can pass use the `PHP_EXTENSION_LIBS` Docker ARG: + +```console +docker buildx bake \ + --load \ + --set static-builder.args.PHP_EXTENSIONS=gd \ + --set static-builder.args.PHP_EXTENSION_LIBS=libjpeg,libwebp \ + static-builder +``` + ### GitHub Token If you hit the GitHub API rate limit, set a GitHub Personal Access Token in an environment variable named `GITHUB_TOKEN`: diff --git a/static-builder.Dockerfile b/static-builder.Dockerfile index 2786a0f3f..6731d1c24 100644 --- a/static-builder.Dockerfile +++ b/static-builder.Dockerfile @@ -3,7 +3,8 @@ FROM golang-base ARG FRANKENPHP_VERSION='dev' ARG PHP_VERSION='8.2' -ARG PHP_EXTENSIONS='bcmath,calendar,ctype,curl,dba,dom,exif,filter,fileinfo,gd,iconv,intl,mbstring,mbregex,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sqlite3,tokenizer,xml,xmlreader,xmlwriter,zip,zlib,apcu' +ARG PHP_EXTENSIONS='apcu,bcmath,bz2,calendar,ctype,curl,dba,dom,exif,fileinfo,filter,gd,iconv,intl,ldap,mbregex,mbstring,mysqli,mysqlnd,opcache,openssl,pcntl,pdo,pdo_mysql,pdo_pgsql,pdo_sqlite,pgsql,phar,posix,readline,redis,session,simplexml,sockets,sqlite3,sysvsem,tokenizer,xml,xmlreader,xmlwriter,zip,zlib' +ARG PHP_EXTENSION_LIBS='freetype,libjpeg,libavif,libwebp,libzip,bzip2' RUN apk update; \ apk add --no-cache \ @@ -57,7 +58,7 @@ RUN git clone --depth=1 https://github.com/crazywhalecc/static-php-cli . && \ RUN --mount=type=secret,id=github-token GITHUB_TOKEN=$(cat /run/secrets/github-token) ./bin/spc download --with-php=$PHP_VERSION --all -RUN ./bin/spc build --build-embed --enable-zts "$PHP_EXTENSIONS" +RUN ./bin/spc build --build-embed --enable-zts --disable-opcache-jit "$PHP_EXTENSIONS" --with-libs="$PHP_EXTENSION_LIBS" ENV PATH="/static-php-cli/buildroot/bin:/static-php-cli/buildroot/usr/bin:$PATH"