Skip to content

Commit b107f03

Browse files
authored
feat(protobuf): adding protobuf layer (#619)
1 parent 7e98ef1 commit b107f03

File tree

3 files changed

+31
-0
lines changed

3 files changed

+31
-0
lines changed

layers/protobuf/Dockerfile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
ARG PHP_VERSION
2+
ARG BREF_VERSION
3+
FROM bref/build-php-$PHP_VERSION:$BREF_VERSION AS ext
4+
5+
RUN MAKEFLAGS="-j $(nproc)" pecl install protobuf > /dev/null
6+
RUN cp `php-config --extension-dir`/protobuf.so /tmp/protobuf.so
7+
RUN strip --strip-debug /tmp/protobuf.so
8+
RUN echo 'extension=protobuf.so' > /tmp/ext.ini
9+
10+
# Build the final image with just the files we need
11+
FROM scratch
12+
13+
# Copy things we installed to the final image
14+
COPY --from=ext /tmp/protobuf.so /opt/bref/extensions/protobuf.so
15+
COPY --from=ext /tmp/ext.ini /opt/bref/etc/php/conf.d/ext-protobuf.ini

layers/protobuf/config.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"php": [
3+
"81",
4+
"82",
5+
"83",
6+
"84"
7+
]
8+
}

layers/protobuf/test.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?php
2+
3+
if (!class_exists($function = \Google\Protobuf\Any::class)) {
4+
echo sprintf('FAIL: Class "%s" does not exist.', $function) . PHP_EOL;
5+
exit(1);
6+
}
7+
8+
exit(0);

0 commit comments

Comments
 (0)