-
-
Notifications
You must be signed in to change notification settings - Fork 112
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d709b8a
commit 7130c08
Showing
3 changed files
with
55 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
ARG PHP_VERSION | ||
FROM bref/build-php-$PHP_VERSION:1.1.4 AS ext | ||
|
||
ENV LIBRDKAFKA_BUILD_DIR=${BUILD_DIR}/librdkafka | ||
|
||
RUN set -xe; \ | ||
mkdir -p ${LIBRDKAFKA_BUILD_DIR}; \ | ||
# Download and upack the source code | ||
curl -Ls https://github.com/edenhill/librdkafka/archive/refs/tags/v1.7.0.tar.gz \ | ||
| tar xzC ${LIBRDKAFKA_BUILD_DIR} | ||
|
||
# Move into the unpackaged code directory | ||
WORKDIR ${LIBRDKAFKA_BUILD_DIR}/librdkafka-1.7.0/ | ||
|
||
# Install | ||
RUN set -xe; \ | ||
./configure --prefix=${INSTALL_DIR} && \ | ||
make && \ | ||
make install | ||
|
||
RUN pecl install --onlyreqdeps --nobuild rdkafka && \ | ||
cd "$(pecl config-get temp_dir)/rdkafka" && \ | ||
phpize && \ | ||
./configure --with-rdkafka=${INSTALL_DIR} && \ | ||
make && \ | ||
make install && \ | ||
cd - | ||
|
||
RUN cp /opt/bref/lib/php/extensions/no-debug-non-zts-*/rdkafka.so /tmp/rdkafka.so | ||
RUN echo 'extension=/opt/bref-extra/rdkafka.so' > /tmp/ext.ini | ||
|
||
|
||
# Build the final image with just the files we need | ||
FROM scratch | ||
|
||
# Copy things we installed to the final image | ||
COPY --from=ext /tmp/rdkafka.so /opt/bref-extra/rdkafka.so | ||
COPY --from=ext /tmp/ext.ini /opt/bref/etc/php/conf.d/ext-rdkafka.ini | ||
COPY --from=ext /opt/bref/lib/librdkafka* /opt/bref/lib/ | ||
COPY --from=ext /opt/bref/include/librdkafka /opt/bref/include/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"php": [ | ||
"73", | ||
"74", | ||
"80" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?php | ||
|
||
if (!class_exists($class = RdKafka\KafkaConsumer::class)) { | ||
echo sprintf('FAIL: Class "%s" does not exist.', $class).PHP_EOL; | ||
exit(1); | ||
} | ||
|
||
exit(0); |