From 84854c8f0d6578dcc75fb151f787c70d90e38301 Mon Sep 17 00:00:00 2001 From: kideny Date: Tue, 27 Sep 2022 06:01:13 +0800 Subject: [PATCH] update phalcon support --- .env.example | 4 ++-- php-fpm/Dockerfile | 18 +++++------------- php-worker/Dockerfile | 28 ++++++++++++---------------- workspace/Dockerfile | 19 ++++++------------- 4 files changed, 25 insertions(+), 44 deletions(-) diff --git a/.env.example b/.env.example index fcf07853..6d1721ed 100644 --- a/.env.example +++ b/.env.example @@ -43,8 +43,8 @@ PHP_VERSION=7.4 ### Phalcon Version ########################################### -# Select a Phalcon version of the Workspace and PHP-FPM containers (Does not apply to HHVM). Accepted values: 3.4.0+ -PHALCON_VERSION=4.0.5 +# Select a Phalcon version of the Workspace and PHP-FPM containers (Does not apply to HHVM). Accepted values: 5.0.0+ +PHALCON_VERSION=5.0.0 ### PHP Interpreter ####################################### diff --git a/php-fpm/Dockerfile b/php-fpm/Dockerfile index 46ecbaf2..280e0682 100644 --- a/php-fpm/Dockerfile +++ b/php-fpm/Dockerfile @@ -854,20 +854,12 @@ ENV LARADOCK_PHALCON_VERSION ${LARADOCK_PHALCON_VERSION} COPY ./phalcon.ini /usr/local/etc/php/conf.d/phalcon.ini.disable RUN if [ $INSTALL_PHALCON = true ]; then \ - apt-get install -yqq unzip libpcre3-dev gcc make re2c git automake autoconf\ - && git clone https://github.com/jbboehr/php-psr.git \ - && cd php-psr \ - && phpize \ - && ./configure \ - && make \ - && make test \ - && make install \ - && curl -L -o /tmp/cphalcon.zip https://github.com/phalcon/cphalcon/archive/v${LARADOCK_PHALCON_VERSION}.zip \ - && unzip -d /tmp/ /tmp/cphalcon.zip \ - && cd /tmp/cphalcon-${LARADOCK_PHALCON_VERSION}/build \ - && ./install \ + echo '' | pecl install phalcon-${LARADOCK_PHALCON_VERSION} ; \ && mv /usr/local/etc/php/conf.d/phalcon.ini.disable /usr/local/etc/php/conf.d/phalcon.ini \ - && rm -rf /tmp/cphalcon* \ + && echo "extension=psr.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/phalcon.ini \ + && echo "extension=phalcon.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/phalcon.ini \ + && ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/phalcon.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-phalcon.ini \ + && docker-php-ext-enable phalcon \ ;fi ########################################################################### diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index 687ba903..b45d413d 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -310,24 +310,20 @@ RUN if [ ${INSTALL_CASSANDRA} = true ]; then \ # Install Phalcon ext ARG INSTALL_PHALCON=false -ARG PHALCON_VERSION -ENV PHALCON_VERSION ${PHALCON_VERSION} +ARG LARADOCK_PHALCON_VERSION +ENV LARADOCK_PHALCON_VERSION ${LARADOCK_PHALCON_VERSION} + +# Copy phalcon configration +COPY ./phalcon.ini /usr/local/etc/php/conf.d/phalcon.ini.disable RUN if [ $INSTALL_PHALCON = true ]; then \ - apk --update add unzip gcc make re2c bash\ - && git clone https://github.com/jbboehr/php-psr.git \ - && cd php-psr \ - && phpize \ - && ./configure \ - && make \ - && make test \ - && make install \ - && curl -L -o /tmp/cphalcon.zip https://github.com/phalcon/cphalcon/archive/v${PHALCON_VERSION}.zip \ - && unzip -d /tmp/ /tmp/cphalcon.zip \ - && cd /tmp/cphalcon-${PHALCON_VERSION}/build \ - && ./install \ - && rm -rf /tmp/cphalcon* \ - ;fi + echo '' | pecl install phalcon-${LARADOCK_PHALCON_VERSION} ; \ + && mv /usr/local/etc/php/conf.d/phalcon.ini.disable /usr/local/etc/php/conf.d/phalcon.ini \ + && echo "extension=psr.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/phalcon.ini \ + && echo "extension=phalcon.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/phalcon.ini \ + && ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/phalcon.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-phalcon.ini \ + && docker-php-ext-enable phalcon \ +;fi ARG INSTALL_GHOSTSCRIPT=false RUN if [ $INSTALL_GHOSTSCRIPT = true ]; then \ diff --git a/workspace/Dockerfile b/workspace/Dockerfile index 5eee6679..60565b1b 100644 --- a/workspace/Dockerfile +++ b/workspace/Dockerfile @@ -1321,23 +1321,16 @@ ARG INSTALL_PHALCON=false ARG LARADOCK_PHALCON_VERSION ENV LARADOCK_PHALCON_VERSION ${LARADOCK_PHALCON_VERSION} +# Copy phalcon configration +COPY ./phalcon.ini /usr/local/etc/php/conf.d/phalcon.ini.disable + RUN if [ $INSTALL_PHALCON = true ]; then \ - apt-get update && apt-get install -yqq unzip libpcre3-dev gcc make re2c git automake autoconf\ - && git clone https://github.com/jbboehr/php-psr.git \ - && cd php-psr \ - && phpize \ - && ./configure \ - && make \ - && make test \ - && make install \ - && curl -L -o /tmp/cphalcon.zip https://github.com/phalcon/cphalcon/archive/v${LARADOCK_PHALCON_VERSION}.zip \ - && unzip -d /tmp/ /tmp/cphalcon.zip \ - && cd /tmp/cphalcon-${LARADOCK_PHALCON_VERSION}/build \ - && ./install \ + echo '' | pecl install phalcon-${LARADOCK_PHALCON_VERSION} ; \ + && mv /usr/local/etc/php/conf.d/phalcon.ini.disable /usr/local/etc/php/conf.d/phalcon.ini \ && echo "extension=psr.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/phalcon.ini \ && echo "extension=phalcon.so" >> /etc/php/${LARADOCK_PHP_VERSION}/mods-available/phalcon.ini \ && ln -s /etc/php/${LARADOCK_PHP_VERSION}/mods-available/phalcon.ini /etc/php/${LARADOCK_PHP_VERSION}/cli/conf.d/30-phalcon.ini \ - && rm -rf /tmp/cphalcon* \ + && docker-php-ext-enable phalcon \ ;fi ###########################################################################