From f1bcc81ec6d11af791384b52305c46b1c69ce2be Mon Sep 17 00:00:00 2001 From: "Shao Yu-Lung (Allen)" Date: Sat, 17 Apr 2021 01:03:40 +0800 Subject: [PATCH 1/2] fix horizon memcached --- laravel-horizon/Dockerfile | 35 +++++++++++------------------------ 1 file changed, 11 insertions(+), 24 deletions(-) diff --git a/laravel-horizon/Dockerfile b/laravel-horizon/Dockerfile index bdee4c3..a0903d6 100644 --- a/laravel-horizon/Dockerfile +++ b/laravel-horizon/Dockerfile @@ -23,7 +23,6 @@ RUN apk --update add wget \ curl \ git \ build-base \ - libmemcached-dev \ libmcrypt-dev \ libxml2-dev \ pcre-dev \ @@ -40,13 +39,6 @@ RUN apk --update add wget \ RUN pecl channel-update pecl.php.net; \ docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl -RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install memcached-2.2.0 mcrypt-1.0.1; \ - else \ - pecl install memcached mcrypt-1.0.1; \ - fi; \ - docker-php-ext-enable memcached - # Add a non-root user to help install ffmpeg: ARG PUID=1000 ENV PUID ${PUID} @@ -270,25 +262,20 @@ RUN if [ ${INSTALL_YAML} = true ]; then \ ARG INSTALL_MEMCACHED=false RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ + apk --update add libmemcached-dev; \ # Install the php memcached extension if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/2.2.0.tar.gz"; \ + pecl install memcached-2.2.0; \ else \ - curl -L -o /tmp/memcached.tar.gz "https://github.com/php-memcached-dev/php-memcached/archive/v3.1.4.tar.gz"; \ - fi \ - && mkdir -p memcached \ - && tar -C memcached -zxvf /tmp/memcached.tar.gz --strip 1 \ - && ( \ - cd memcached \ - && phpize \ - && ./configure \ - && make -j$(nproc) \ - && make install \ - ) \ - && rm -r memcached \ - && rm /tmp/memcached.tar.gz \ - && docker-php-ext-enable memcached \ - ;fi + pecl install memcached; \ + fi; \ + docker-php-ext-enable memcached; \ + php -m | grep -r 'memcached'; \ +fi + +#-------------------------------------------------------------------------- +# Clean up +#-------------------------------------------------------------------------- RUN rm /var/cache/apk/* \ && mkdir -p /var/www From ddcf0b08daf1a077e2339bb82e6863983dcbddae Mon Sep 17 00:00:00 2001 From: "Shao Yu-Lung (Allen)" Date: Sat, 17 Apr 2021 01:08:33 +0800 Subject: [PATCH 2/2] php-worker support memcached extension --- .env.example | 1 + docker-compose.yml | 1 + php-worker/Dockerfile | 26 ++++++++++++++++++-------- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.env.example b/.env.example index c3055ba..1d66fa4 100644 --- a/.env.example +++ b/.env.example @@ -288,6 +288,7 @@ PHP_WORKER_INSTALL_GNUPG=false PHP_WORKER_INSTALL_PGSQL=false PHP_WORKER_INSTALL_MONGO=false PHP_WORKER_INSTALL_BCMATH=false +PHP_WORKER_INSTALL_MEMCACHED=false # PHP_WORKER_INSTALL_OCI8 Does not work in php5.6 version PHP_WORKER_INSTALL_OCI8=false PHP_WORKER_INSTALL_PHALCON=false diff --git a/docker-compose.yml b/docker-compose.yml index 86202e6..f162cbd 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -318,6 +318,7 @@ services: - INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL} - INSTALL_MONGO=${PHP_WORKER_INSTALL_MONGO} - INSTALL_BCMATH=${PHP_WORKER_INSTALL_BCMATH} + - INSTALL_MEMCACHED=${PHP_WORKER_INSTALL_MEMCACHED} - INSTALL_OCI8=${PHP_WORKER_INSTALL_OCI8} - INSTALL_PHALCON=${PHP_WORKER_INSTALL_PHALCON} - INSTALL_SOAP=${PHP_WORKER_INSTALL_SOAP} diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index f0ca0a9..9f4bfb2 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -23,7 +23,6 @@ RUN apk --update add wget \ curl \ git \ build-base \ - libmemcached-dev \ libmcrypt-dev \ libxml2-dev \ pcre-dev \ @@ -40,13 +39,6 @@ RUN apk --update add wget \ RUN pecl channel-update pecl.php.net; \ docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl -RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl install memcached-2.2.0 mcrypt-1.0.1; \ - else \ - pecl install memcached mcrypt-1.0.1; \ - fi; \ - docker-php-ext-enable memcached - # Add a non-root user: ARG PUID=1000 ENV PUID ${PUID} @@ -404,6 +396,24 @@ RUN if [ ${INSTALL_XMLRPC} = true ]; then \ php -m | grep -r 'xmlrpc'; \ fi +########################################################################### +# PHP Memcached: +########################################################################### + +ARG INSTALL_MEMCACHED=false + +RUN if [ ${INSTALL_MEMCACHED} = true ]; then \ + apk --update add libmemcached-dev; \ + # Install the php memcached extension + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ + pecl install memcached-2.2.0; \ + else \ + pecl install memcached; \ + fi; \ + docker-php-ext-enable memcached; \ + php -m | grep -r 'memcached'; \ +fi + # #-------------------------------------------------------------------------- # Optional Supervisord Configuration