Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add brotli extension support #547

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.**


Expand Down Expand Up @@ -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}` |
Expand Down
14 changes: 14 additions & 0 deletions layers/brotli/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
8 changes: 8 additions & 0 deletions layers/brotli/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"php": [
"80",
"81",
"82",
"83"
]
}
33 changes: 33 additions & 0 deletions layers/brotli/test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

if (!function_exists($func = 'brotli_compress')) {
echo sprintf('FAIL: Function "%s" does not exist.', $func).PHP_EOL;
exit(1);
}

if (!function_exists($func = 'brotli_uncompress')) {
echo sprintf('FAIL: Function "%s" does not exist.', $func).PHP_EOL;
exit(1);
}

if (!function_exists($func = 'brotli_compress_init')) {
echo sprintf('FAIL: Function "%s" does not exist.', $func).PHP_EOL;
exit(1);
}

if (!function_exists($func = 'brotli_compress_add')) {
echo sprintf('FAIL: Function "%s" does not exist.', $func).PHP_EOL;
exit(1);
}

if (!function_exists($func = 'brotli_uncompress_init')) {
echo sprintf('FAIL: Function "%s" does not exist.', $func).PHP_EOL;
exit(1);
}

if (!function_exists($func = 'brotli_uncompress_add')) {
echo sprintf('FAIL: Function "%s" does not exist.', $func).PHP_EOL;
exit(1);
}

exit(0);
Loading