Merge pull request #3209 from Yohoed2000/feature/add_event_extension

Add php event extension
This commit is contained in:
Shao Yu-Lung (Allen) 2022-07-18 21:27:06 +08:00 committed by GitHub
commit 7eaaa0cedc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 105 additions and 0 deletions

View File

@ -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

View File

@ -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}

View File

@ -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:
###########################################################################

View File

@ -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

View File

@ -1738,6 +1738,41 @@ 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 &&\
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 &&\
cd /tmp/event-php &&\
phpize &&\
./configure --with-event-libevent-dir=/usr/local/libevent-2.1.12/ &&\
make &&\
make install &&\
rm /tmp/event.tar.gz &&\
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