From a7788a7f9c4b713d33695d99a5d0417129291214 Mon Sep 17 00:00:00 2001 From: Seto Kuslaksono Date: Fri, 12 Jul 2024 17:30:48 +0700 Subject: [PATCH] Add brotli extension support --- Readme.md | 3 ++- layers/brotli/Dockerfile | 14 ++++++++++++++ layers/brotli/config.json | 8 ++++++++ layers/brotli/test.php | 33 +++++++++++++++++++++++++++++++++ 4 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 layers/brotli/Dockerfile create mode 100644 layers/brotli/config.json create mode 100644 layers/brotli/test.php diff --git a/Readme.md b/Readme.md index 9b1b58ef..3483fe87 100644 --- a/Readme.md +++ b/Readme.md @@ -14,7 +14,7 @@ a limit of 5 layers per Lambda. You can also utilise the provided docker images > **Warning** -> +> > **ARM64 is not supported yet with Bref v2.** @@ -52,6 +52,7 @@ functions: |:-----------------|:---------------------------------------| | AMQP | `${bref-extra:amqp-php-81}` | | Blackfire | `${bref-extra:blackfire-php-81}` | +| Brotli | `${bref-extra:brotli-php-81}` | | Bsdiff | `${bref-extra:bsdiff-php-81}` | | Calendar | `${bref-extra:calendar-php-81}` | | Cassandra | `${bref-extra:cassandra-php-81}` | diff --git a/layers/brotli/Dockerfile b/layers/brotli/Dockerfile new file mode 100644 index 00000000..98fae56f --- /dev/null +++ b/layers/brotli/Dockerfile @@ -0,0 +1,14 @@ +ARG PHP_VERSION +ARG BREF_VERSION +FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext + +RUN pecl install brotli-0.15.0 +RUN cp `php-config --extension-dir`/brotli.so /tmp/brotli.so +RUN echo 'extension=brotli.so' > /tmp/ext.ini + +# Build the final image with just the files we need +FROM scratch + +# Copy the things we installed to the final image +COPY --from=ext /tmp/brotli.so /opt/bref/extensions/brotli.so +COPY --from=ext /tmp/ext.ini /opt/bref/etc/php/conf.d/ext-brotli.ini diff --git a/layers/brotli/config.json b/layers/brotli/config.json new file mode 100644 index 00000000..eea4b0f4 --- /dev/null +++ b/layers/brotli/config.json @@ -0,0 +1,8 @@ +{ + "php": [ + "80", + "81", + "82", + "83" + ] +} diff --git a/layers/brotli/test.php b/layers/brotli/test.php new file mode 100644 index 00000000..da40d428 --- /dev/null +++ b/layers/brotli/test.php @@ -0,0 +1,33 @@ +