From a285caa18f5a5b46ca1d968807a93a73819ce495 Mon Sep 17 00:00:00 2001 From: Wuweiming <1052701694@qq.com> Date: Fri, 6 May 2022 16:11:29 +0800 Subject: [PATCH 1/2] add php event --- .env.example | 3 +++ docker-compose.yml | 3 +++ php-fpm/Dockerfile | 32 ++++++++++++++++++++++++++++++++ php-worker/Dockerfile | 32 ++++++++++++++++++++++++++++++++ workspace/Dockerfile | 32 ++++++++++++++++++++++++++++++++ 5 files changed, 102 insertions(+) diff --git a/.env.example b/.env.example index 3adafe9..387864f 100644 --- a/.env.example +++ b/.env.example @@ -203,6 +203,7 @@ WORKSPACE_INSTALL_SSDB=false WORKSPACE_INSTALL_TRADER=false WORKSPACE_PROTOC_VERSION=latest WORKSPACE_INSTALL_MEMCACHED=true +WORKSPACE_INSTALL_EVENT=false ### PHP_FPM ############################################### @@ -274,6 +275,7 @@ PHP_FPM_ADDITIONAL_LOCALES="en_US.UTF-8 es_ES.UTF-8 fr_FR.UTF-8" PHP_FPM_INSTALL_DOCKER_CLIENT=false PHP_FPM_DEFAULT_LOCALE=POSIX PHP_FPM_XDEBUG_PORT=9003 +PHP_FPM_INSTALL_EVENT=false PHP_FPM_PUID=1000 PHP_FPM_PGID=1000 @@ -317,6 +319,7 @@ PHP_WORKER_INSTALL_REDIS=false PHP_WORKER_INSTALL_IMAP=false PHP_WORKER_INSTALL_XMLRPC=false PHP_WORKER_INSTALL_SSDB=false +PHP_WORKER_INSTALL_EVENT=false PHP_WORKER_PUID=1000 PHP_WORKER_PGID=1000 diff --git a/docker-compose.yml b/docker-compose.yml index 70cef48..028ec11 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -172,6 +172,7 @@ services: - PROTOC_VERSION=${WORKSPACE_PROTOC_VERSION} - INSTALL_DOCKER_CLIENT=${WORKSPACE_INSTALL_DOCKER_CLIENT} - INSTALL_MEMCACHED=${WORKSPACE_INSTALL_MEMCACHED} + - INSTALL_EVENT=${WORKSPACE_INSTALL_EVENT} - http_proxy - https_proxy - no_proxy @@ -274,6 +275,7 @@ services: - INSTALL_ZOOKEEPER=${PHP_FPM_INSTALL_ZOOKEEPER} - INSTALL_SSDB=${PHP_FPM_INSTALL_SSDB} - INSTALL_TRADER=${PHP_FPM_INSTALL_TRADER} + - INSTALL_EVENT=${PHP_FPM_INSTALL_EVENT} - DOWNGRADE_OPENSSL_TLS_AND_SECLEVEL=${PHP_DOWNGRADE_OPENSSL_TLS_AND_SECLEVEL} - PUID=${PHP_FPM_PUID} - PGID=${PHP_FPM_PGID} @@ -347,6 +349,7 @@ services: - INSTALL_IMAP=${PHP_WORKER_INSTALL_IMAP} - INSTALL_XMLRPC=${PHP_WORKER_INSTALL_XMLRPC} - INSTALL_SSDB=${PHP_WORKER_INSTALL_SSDB} + - INSTALL_EVENT=${PHP_WORKER_INSTALL_EVENT} - PUID=${PHP_WORKER_PUID} - PGID=${PHP_WORKER_PGID} - IMAGEMAGICK_VERSION=${PHP_WORKER_IMAGEMAGICK_VERSION} diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 57578eb..724097a 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -1236,6 +1236,38 @@ RUN if [ ${INSTALL_ZMQ} = true ]; then \ && echo "extension=zmq.so" > /usr/local/etc/php/conf.d/zmq.ini \ ;fi + +############################################################################ +## Event: +############################################################################ +USER root + +ARG INSTALL_EVENT=false + +RUN set -eux; \ + if [ ${INSTALL_EVENT} = true ]; then \ + curl -L -o /tmp/libevent.tar.gz https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz &&\ + mkdir -p /tmp/libevent-php &&\ + tar -C /tmp/libevent-php -zxvf /tmp/libevent.tar.gz --strip 1 &&\ + cd /tmp/libevent-php &&\ + ./configure --prefix=/usr/local/libevent-2.1.12 &&\ + make &&\ + make install &&\ + rm /tmp/libevent.tar.gz &&\ + docker-php-ext-install sockets &&\ + curl -L -o /tmp/event.tar.gz http://pecl.php.net/get/event-3.0.6.tgz &&\ + mkdir -p /tmp/event-php &&\ + tar -C /tmp/event-php -zxvf /tmp/event.tar.gz --strip 1 &&\ + cd /tmp/event-php &&\ + phpize &&\ + ./configure --with-event-libevent-dir=/usr/local/libevent-2.1.12/ &&\ + make &&\ + make install &&\ + rm /tmp/event.tar.gz &&\ + docker-php-ext-enable event &&\ + php -m | grep -q 'event' \ +;fi + ########################################################################### # Check PHP version: ########################################################################### diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index ee6d189..a9ee94c 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -508,6 +508,38 @@ RUN set -xe; \ && docker-php-ext-enable ssdb \ ;fi + +############################################################################ +## Event: +############################################################################ +USER root + +ARG INSTALL_EVENT=false + +RUN set -eux; \ + if [ ${INSTALL_EVENT} = true ]; then \ + curl -L -o /tmp/libevent.tar.gz https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz &&\ + mkdir -p /tmp/libevent-php &&\ + tar -C /tmp/libevent-php -zxvf /tmp/libevent.tar.gz --strip 1 &&\ + cd /tmp/libevent-php &&\ + ./configure --prefix=/usr/local/libevent-2.1.12 &&\ + make &&\ + make install &&\ + rm /tmp/libevent.tar.gz &&\ + docker-php-ext-install sockets &&\ + curl -L -o /tmp/event.tar.gz http://pecl.php.net/get/event-3.0.6.tgz &&\ + mkdir -p /tmp/event-php &&\ + tar -C /tmp/event-php -zxvf /tmp/event.tar.gz --strip 1 &&\ + cd /tmp/event-php &&\ + phpize &&\ + ./configure --with-event-libevent-dir=/usr/local/libevent-2.1.12/ &&\ + make &&\ + make install &&\ + rm /tmp/event.tar.gz &&\ + docker-php-ext-enable event &&\ + php -m | grep -q 'event' \ +;fi + # #-------------------------------------------------------------------------- # Optional Supervisord Configuration diff --git a/workspace/Dockerfile b/workspace/Dockerfile index a67bc20..48c199c 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1733,6 +1733,38 @@ RUN if [ ${INSTALL_ZMQ} = true ]; then \ && ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/zmq.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-zmq.ini \ ;fi +############################################################################ +## Event: +############################################################################ +USER root + +ARG INSTALL_EVENT=false + +RUN set -eux; \ + if [ ${INSTALL_EVENT} = true ]; then \ + curl -L -o /tmp/libevent.tar.gz https://github.com/libevent/libevent/releases/download/release-2.1.12-stable/libevent-2.1.12-stable.tar.gz &&\ + mkdir -p /tmp/libevent-php &&\ + tar -C /tmp/libevent-php -zxvf /tmp/libevent.tar.gz --strip 1 &&\ + cd /tmp/libevent-php &&\ + ./configure --prefix=/usr/local/libevent-2.1.12 &&\ + make &&\ + make install &&\ + rm /tmp/libevent.tar.gz &&\ + docker-php-ext-install sockets &&\ + curl -L -o /tmp/event.tar.gz http://pecl.php.net/get/event-3.0.6.tgz &&\ + mkdir -p /tmp/event-php &&\ + tar -C /tmp/event-php -zxvf /tmp/event.tar.gz --strip 1 &&\ + cd /tmp/event-php &&\ + phpize &&\ + ./configure --with-event-libevent-dir=/usr/local/libevent-2.1.12/ &&\ + make &&\ + make install &&\ + rm /tmp/event.tar.gz &&\ + docker-php-ext-enable event &&\ + php -m | grep -q 'event' \ +;fi + + # #-------------------------------------------------------------------------- # Final Touch From baeb2a2cb667a631b78f42182459209abe058a05 Mon Sep 17 00:00:00 2001 From: Wuweiming <1052701694@qq.com> Date: Mon, 9 May 2022 10:31:31 +0800 Subject: [PATCH 2/2] fix workspace DockerFile --- workspace/Dockerfile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 48c199c..3193069 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1750,7 +1750,8 @@ RUN set -eux; \ make &&\ make install &&\ rm /tmp/libevent.tar.gz &&\ - docker-php-ext-install sockets &&\ + echo "extension=sockets.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/sockets.ini && \ + ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/sockets.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-sockets.ini && \ curl -L -o /tmp/event.tar.gz http://pecl.php.net/get/event-3.0.6.tgz &&\ mkdir -p /tmp/event-php &&\ tar -C /tmp/event-php -zxvf /tmp/event.tar.gz --strip 1 &&\ @@ -1760,11 +1761,13 @@ RUN set -eux; \ make &&\ make install &&\ rm /tmp/event.tar.gz &&\ - docker-php-ext-enable event &&\ + echo "extension=event.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/event.ini && \ + ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/event.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/20-event.ini && \ php -m | grep -q 'event' \ ;fi + # #-------------------------------------------------------------------------- # Final Touch