Here's a minimal dockerfile that sets up php8 with swoole. The container should print out the package list and exit.
FROM alpine
RUN set -eux; \
apk add --clean-protected --no-cache \
-X http://dl-cdn.alpinelinux.org/alpine/edge/testing \
php8 \
php8-pecl-swoole; \
ln -s /usr/bin/php8 /usr/bin/php
# Launch
CMD ["php", "-m"]
Here's the output, swoole is not among the loaded modules and instead is mentioned in a warning:
PHP Warning: PHP Startup: Unable to load dynamic library 'swoole' (tried: /usr/lib/php8/modules/swoole (Error loading shared library /usr/lib/php8/modules/swoole: No such file or directory), /usr/lib/php8/modules/swoole.so (Error relocating /usr/lib/php8/modules/swoole.so: _ZSt28__throw_bad_array_new_lengthv: symbol not found)) in Unknown on line 0
[PHP Modules]
Core
curl
date
filter
hash
json
libxml
mysqlnd
openssl
pcre
phpdbg_webhelper
readline
Reflection
sockets
SPL
standard
zlib
[Zend Modules]
The file /usr/lib/php8/modules/swoole.so
actually exists, but there's some error with loading it.
A similar setup worked fine a while ago when I used alpine:3.13
image and got the php8-pecl-swoole-4.7.1-r0
package which doesn't seem available anymore. The issue with the current php8-pecl-swoole
package is present when using alpine 3.13, 3.14 and 3.15.