Skip to content

Commit 91c2a84

Browse files
Frank Koornstrarenatomefi
authored andcommitted
Add helper script to install RD Kafka extension
As well as the needed dependencies. Using projects only need to call docker-php-ext-rdkafka to enable the RD Kafka extension.
1 parent 7b074ed commit 91c2a84

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,3 +286,7 @@ RUN set -x \
286286
&& docker-php-ext-enable mongodb \
287287
&& apk del .build-deps
288288
```
289+
290+
#### RD Kafka
291+
292+
Since the RD Kafka extension is used across multiple projects, a helper script is provided to install both the dependencies and the extension in a uniform fashion. Run `docker-php-ext-rdkafka` to profit.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
set -xe
4+
5+
# shellcheck disable=SC2086
6+
apk add --no-cache --virtual .build-deps $PHPIZE_DEPS
7+
apk add --no-cache librdkafka-dev
8+
9+
pecl install rdkafka
10+
11+
docker-php-ext-enable rdkafka
12+
13+
apk del .build-deps

test/container/test_helper_scripts.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ def test_php_images_contain_helper_scripts(host):
88
"/usr/local/bin/docker-php-ext-install",
99
"/usr/local/bin/docker-php-ext-enable",
1010
"/usr/local/bin/docker-php-ext-configure",
11+
"/usr/local/bin/docker-php-ext-rdkafka",
1112
"/usr/local/bin/docker-php-entrypoint",
1213
"/usr/local/bin/php-fpm-healthcheck",
1314
]
@@ -45,3 +46,9 @@ def test_php_fpm_status_is_enabled(host):
4546
health_check = host.run("php-fpm-healthcheck -v")
4647
assert health_check.rc == 0
4748
assert "pool:" in health_check.stdout
49+
50+
@pytest.mark.php
51+
def test_php_source_tarball_script(host):
52+
host.run_expect([0], "docker-php-ext-rdkafka")
53+
54+
assert 'rdkafka' in host.run('php -m').stdout

0 commit comments

Comments
 (0)