diff --git a/Dockerfile-nts-alpine b/Dockerfile-nts-alpine index e957345..e2f4740 100644 --- a/Dockerfile-nts-alpine +++ b/Dockerfile-nts-alpine @@ -23,7 +23,7 @@ RUN apk update \ COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ FROM base AS base-build -RUN apk add --no-cache $PHPIZE_DEPS git libuv-dev +RUN apk add --no-cache $PHPIZE_DEPS git libuv-dev liburing-dev linux-headers FROM base-build AS build-uv RUN git clone https://github.com/amphp/ext-uv uv @@ -37,9 +37,26 @@ RUN git fetch \ && cp "$EXTENSION_DIR/uv.so" /uv.so \ && sha256sum /uv.so +FROM base-build AS build-mrloop + +RUN git clone https://github.com/ace411/mrloop.git /mrloop \ + && git clone https://github.com/h2o/picohttpparser.git /picohttpparser \ + && git clone https://github.com/ringphp/php-mrloop.git /ext-mrloop +WORKDIR /ext-mrloop +RUN git fetch \ + && git pull \ + && phpize \ + && ./configure --with-mrloop=/mrloop --with-picohttp=/picohttpparser \ + && make \ + && make install \ + && EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` \ + && cp "$EXTENSION_DIR/mrloop.so" /mrloop.so \ + && sha256sum /mrloop.so + FROM base AS nts-slim-root COPY --from=build-uv /uv.so /uv.so +COPY --from=build-mrloop /mrloop.so /mrloop.so # Install docker help scripts COPY src/php/utils/docker/ /usr/local/bin/ @@ -51,6 +68,7 @@ RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \ mv /*.so "$EXTENSION_DIR/" && \ apk add --no-cache \ libuv-dev \ + liburing-dev \ icu-dev \ libevent-dev \ openssl-dev \ @@ -69,6 +87,7 @@ RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \ # To ensure ext-socket loads before ext-event && docker-php-ext-enable --ini-name zzzzz-event.ini event \ && docker-php-ext-enable uv \ + && docker-php-ext-enable mrloop \ && apk del $PHPIZE_DEPS \ && wget -q -O - https://raw.githubusercontent.com/eficode/wait-for/master/wait-for > /bin/wait-for \ && chmod +x /bin/wait-for \ diff --git a/Dockerfile-zts-alpine b/Dockerfile-zts-alpine index ce7d8de..a701ada 100644 --- a/Dockerfile-zts-alpine +++ b/Dockerfile-zts-alpine @@ -23,7 +23,7 @@ RUN apk update \ COPY --from=mlocati/php-extension-installer /usr/bin/install-php-extensions /usr/local/bin/ FROM base AS base-build -RUN apk add --no-cache $PHPIZE_DEPS git libuv-dev +RUN apk add --no-cache $PHPIZE_DEPS git libuv-dev liburing-dev linux-headers FROM base-build AS build-uv RUN git clone https://github.com/amphp/ext-uv uv @@ -37,9 +37,26 @@ RUN git fetch \ && cp "$EXTENSION_DIR/uv.so" /uv.so \ && sha256sum /uv.so +FROM base-build AS build-mrloop + +RUN git clone https://github.com/ace411/mrloop.git /mrloop \ + && git clone https://github.com/h2o/picohttpparser.git /picohttpparser \ + && git clone https://github.com/ringphp/php-mrloop.git /ext-mrloop +WORKDIR /ext-mrloop +RUN git fetch \ + && git pull \ + && phpize \ + && ./configure --with-mrloop=/mrloop --with-picohttp=/picohttpparser \ + && make \ + && make install \ + && EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` \ + && cp "$EXTENSION_DIR/mrloop.so" /mrloop.so \ + && sha256sum /mrloop.so + FROM base AS zts-slim-root COPY --from=build-uv /uv.so /uv.so +COPY --from=build-mrloop /mrloop.so /mrloop.so # Install docker help scripts COPY src/php/utils/docker/alpine/ /usr/local/bin/ @@ -52,6 +69,7 @@ RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \ mv /*.so "$EXTENSION_DIR/" && \ apk add --no-cache \ libuv-dev \ + liburing-dev \ icu-dev \ libevent-dev \ openssl-dev \ @@ -75,6 +93,7 @@ RUN EXTENSION_DIR=`php-config --extension-dir 2>/dev/null` && \ # To ensure ext-socket loads before ext-event && docker-php-ext-enable --ini-name zzzzz-event.ini event \ && docker-php-ext-enable uv \ + && docker-php-ext-enable mrloop \ && apk del $PHPIZE_DEPS \ && wget -q -O - https://raw.githubusercontent.com/eficode/wait-for/master/wait-for > /bin/wait-for \ && chmod +x /bin/wait-for \ diff --git a/README.md b/README.md index 2c77404..f0d37d3 100644 --- a/README.md +++ b/README.md @@ -77,12 +77,13 @@ ENTRYPOINT ["php", "/opt/app/app.php"] NTS, or non-thread safe is the PHP version most people use. This image comes with the following extensions: -| Extension | Description | -|-----------|------------------------------------------| -| ext-eio | Provides interface to the libeio library | -| ext-pcntl | PCNTL OS signals | -| ext-uv | LibUV event loop | -| ext-event | Libevent event loop | +| Extension | Description | +|------------|------------------------------------------| +| ext-eio | Provides interface to the libeio library | +| ext-pcntl | PCNTL OS signals | +| ext-uv | LibUV event loop | +| ext-event | Libevent event loop | +| ext-mrloop | MrLoop event loop | ### ZTS diff --git a/test/container/test_php_ext.py b/test/container/test_php_ext.py index 1d95a74..ff3faa9 100644 --- a/test/container/test_php_ext.py +++ b/test/container/test_php_ext.py @@ -59,6 +59,11 @@ def test_pgsql_is_loaded(host): def test_uv_is_loaded(host): assert 'uv' in host.run('php -m').stdout +@pytest.mark.php_zts +@pytest.mark.php_nts +def test_mrloop_is_loaded(host): + assert 'mrloop' in host.run('php -m').stdout + @pytest.mark.php_not_slim_amd64 def test_vips_is_loaded(host): assert 'vips' in host.run('php -m').stdout