Skip to content
Merged
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 @@ -64,6 +64,7 @@ functions:
| gnupg | `${bref-extra:gnupg-php-81}` |
| GMP | `${bref-extra:gmp-php-81}` |
| gRPC | `${bref-extra:grpc-php-81}` |
| h3 | `${bref-extra:h3-php-81}` |
| Igbinary | `${bref-extra:igbinary-php-81}` |
| Imagick | `${bref-extra:imagick-php-81}` |
| IMAP | `${bref-extra:imap-php-81}` |
Expand Down
41 changes: 41 additions & 0 deletions layers/h3/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
ARG PHP_VERSION
ARG BREF_VERSION
FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext
ARG PHP_VERSION

# Prepare environment
ENV H3_BUILD_DIR=${BUILD_DIR}/h3
RUN mkdir -p ${H3_BUILD_DIR}

# Compile h3
WORKDIR ${H3_BUILD_DIR}
RUN git clone https://github.com/uber/h3.git && \
cd h3 && \
git checkout v3.7.2 && \
cmake -DBUILD_SHARED_LIBS=ON . && \
make -j "$(nproc)" && \
make install

# Compile the php h3 extension
WORKDIR ${H3_BUILD_DIR}/h3-php
RUN curl -L https://github.com/abler98/h3-php/archive/refs/tags/v1.0.0.tar.gz -o h3.tar.gz && \
tar xzf h3.tar.gz && \
cd h3-php-1.0.0 && \
phpize && \
./configure --with-h3 && \
make && \
make install

RUN cp `php-config --extension-dir`/h3.so /tmp/h3.so
RUN strip --strip-debug /tmp/h3.so
RUN echo 'extension=h3.so' > /tmp/ext.ini

RUN php /bref/lib-copy/copy-dependencies.php /tmp/h3.so /tmp/extension-libs

# Build the final image with just the files we need
FROM scratch

# Copy things we installed to the final image
COPY --from=ext /tmp/h3.so /opt/bref/extensions/h3.so
COPY --from=ext /tmp/ext.ini /opt/bref/etc/php/conf.d/ext-h3.ini
COPY --from=ext /tmp/extension-libs /opt/lib
8 changes: 8 additions & 0 deletions layers/h3/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"php": [
"80",
"81",
"82",
"83"
]
}
9 changes: 9 additions & 0 deletions layers/h3/test.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

if (!class_exists($class = \H3\H3Index::class)) {
echo sprintf('FAIL: Class "%s" does not exist.', $class).PHP_EOL;
exit(1);
}


exit(0);
Loading