From 4503360576eac99803a618e1e1e74f03fbbc16fe Mon Sep 17 00:00:00 2001 From: Shao Yu Lung Date: Sat, 20 Mar 2021 19:13:32 +0800 Subject: [PATCH 1/3] remove default install mongodb --- laravel-horizon/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/laravel-horizon/Dockerfile b/laravel-horizon/Dockerfile index 5d2a4bf..194f615 100644 --- a/laravel-horizon/Dockerfile +++ b/laravel-horizon/Dockerfile @@ -35,7 +35,7 @@ RUN apk --update add wget \ procps RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl -RUN pecl channel-update pecl.php.net && pecl install memcached mcrypt-1.0.1 mongodb && docker-php-ext-enable memcached mongodb +RUN pecl channel-update pecl.php.net && pecl install memcached mcrypt-1.0.1 && docker-php-ext-enable memcached # Add a non-root user to help install ffmpeg: ARG PUID=1000 From 6008b3c1ea7a7c800ca2e8cd6861d1cf89670114 Mon Sep 17 00:00:00 2001 From: Shao Yu Lung Date: Sat, 20 Mar 2021 19:15:59 +0800 Subject: [PATCH 2/3] php-worker mongodb install by .env config --- docker-compose.yml | 1 + env-example | 1 + php-worker/Dockerfile | 11 +++++++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 7b51c33..3d9ed77 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -308,6 +308,7 @@ services: - INSTALL_IMAGEMAGICK=${PHP_WORKER_INSTALL_IMAGEMAGICK} - INSTALL_GMP=${PHP_WORKER_INSTALL_GMP} - INSTALL_PGSQL=${PHP_WORKER_INSTALL_PGSQL} + - INSTALL_MONGO=${PHP_WORKER_INSTALL_MONGO} - INSTALL_BCMATH=${PHP_WORKER_INSTALL_BCMATH} - INSTALL_OCI8=${PHP_WORKER_INSTALL_OCI8} - INSTALL_PHALCON=${PHP_WORKER_INSTALL_PHALCON} diff --git a/env-example b/env-example index fa9a4a8..d024d11 100644 --- a/env-example +++ b/env-example @@ -278,6 +278,7 @@ PHP_WORKER_INSTALL_IMAGEMAGICK=false PHP_WORKER_IMAGEMAGICK_VERSION=latest PHP_WORKER_INSTALL_GMP=false PHP_WORKER_INSTALL_PGSQL=false +PHP_WORKER_INSTALL_MONGO=false PHP_WORKER_INSTALL_BCMATH=false # PHP_WORKER_INSTALL_OCI8 Does not work in php5.6 version PHP_WORKER_INSTALL_OCI8=false diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index d3f9743..db1f693 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -38,9 +38,9 @@ RUN apk --update add wget \ RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ - pecl channel-update pecl.php.net && pecl install memcached-2.2.0 mcrypt-1.0.1 mongodb && docker-php-ext-enable memcached mongodb \ + pecl channel-update pecl.php.net && pecl install memcached-2.2.0 mcrypt-1.0.1 && docker-php-ext-enable memcached \ ;else \ - pecl channel-update pecl.php.net && pecl install memcached mcrypt-1.0.1 mongodb && docker-php-ext-enable memcached mongodb \ + pecl channel-update pecl.php.net && pecl install memcached mcrypt-1.0.1 && docker-php-ext-enable memcached \ ;fi # Add a non-root user: @@ -108,6 +108,13 @@ RUN if [ ${INSTALL_SOAP} = true ]; then \ docker-php-ext-install soap \ ;fi +# Install MongoDB drivers: +ARG INSTALL_MONGO=false +RUN if [ ${INSTALL_MONGO} = true ]; then \ + pecl install mongodb; \ + docker-php-ext-enable mongodb; \ + fi + #Install BCMath package: ARG INSTALL_BCMATH=false RUN if [ ${INSTALL_BCMATH} = true ]; then \ From 4d93c69d5d78a725d166145b575b1f6b0d987fd9 Mon Sep 17 00:00:00 2001 From: Shao Yu Lung Date: Sat, 20 Mar 2021 19:39:09 +0800 Subject: [PATCH 3/3] php-worker mongo | PHP 5.6 --- php-worker/Dockerfile | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index db1f693..7a96403 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -111,8 +111,13 @@ RUN if [ ${INSTALL_SOAP} = true ]; then \ # Install MongoDB drivers: ARG INSTALL_MONGO=false RUN if [ ${INSTALL_MONGO} = true ]; then \ - pecl install mongodb; \ - docker-php-ext-enable mongodb; \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ + pecl install mongo; \ + docker-php-ext-enable mongo; \ + else \ + pecl install mongodb; \ + docker-php-ext-enable mongodb; \ + fi; \ fi #Install BCMath package: @@ -357,6 +362,16 @@ RUN if [ ${INSTALL_XMLRPC} = true ]; then \ docker-php-ext-install xmlrpc \ ;fi +RUN if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ + pecl install mongo; \ + docker-php-ext-enable mongo; \ + php -m | grep -q 'mongo'; \ + else \ + pecl install mongodb; \ + docker-php-ext-enable mongodb; \ + php -m | grep -q 'mongodb'; \ + fi + # #-------------------------------------------------------------------------- # Optional Supervisord Configuration