Closed iliavlad closed 1 year ago
Hi there. The DEV image is for debugging purpose and it's not expected to be used in that way.
Here is an example to properly install the pcntl
extension in the Swoole image:
FROM phpswoole/swoole:php8.2
RUN set -ex && \
docker-php-ext-configure pcntl --enable-pcntl && \
docker-php-ext-install pcntl
We can test the Dockerfile with the following commands:
docker build -t testphpswoole-1 . # To build the image.
docker run --rm -ti testphpswoole-1 php -m | grep pcntl # To check if the pcntl extension is loaded or not.
docker run --rm -ti testphpswoole-1 php --ri pcntl # To check configurations of the pcntl extension.
However, in case we do want to install the pcntl
extension in the DEV image, we can do it with multi-stage builds:
FROM phpswoole/swoole:php8.2
RUN set -ex && \
docker-php-ext-configure pcntl --enable-pcntl && \
docker-php-ext-install pcntl
FROM phpswoole/swoole:php8.2-dev
COPY --from=0 /usr/local/lib/php/extensions/no-debug-non-zts-20220829/pcntl.so /usr/local/lib/php/extensions/no-debug-non-zts-20220829/pcntl.so
COPY --from=0 /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini /usr/local/etc/php/conf.d/docker-php-ext-pcntl.ini
Now, we can test the Dockerfile with the following commands:
docker build -t testphpswoole-2 . # To build the image.
docker run --rm -ti testphpswoole-2 php -m | grep pcntl # To check if the pcntl extension is loaded or not.
docker run --rm -ti testphpswoole-2 php --ri pcntl # To check configurations of the pcntl extension.
Dockerfile to test
and run
docker build -t testphpswoole .
expected result (as for phpswoole/swoole image)
actual result
A reason is an additional log in script https://github.com/docker-library/php/blob/6cb0a331566b66ae30c14884cc93cd2b3218d324/docker-php-ext-enable#L4
May be it's possible to advise how to install php extension to dev image of phpswoole