From 360dfbe6ecc6977e024bd43a88e32222d10b989c Mon Sep 17 00:00:00 2001 From: "Shao Yu-Lung (Allen)" Date: Wed, 7 Apr 2021 21:24:23 +0800 Subject: [PATCH 1/2] fix horizon build failed --- laravel-horizon/Dockerfile | 48 ++++++++++++++++++++++++++------------ 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/laravel-horizon/Dockerfile b/laravel-horizon/Dockerfile index 0d48203..198d52f 100644 --- a/laravel-horizon/Dockerfile +++ b/laravel-horizon/Dockerfile @@ -26,19 +26,24 @@ RUN apk --update add wget \ libmemcached-dev \ libmcrypt-dev \ libxml2-dev \ + pcre-dev \ zlib-dev \ autoconf \ cyrus-sasl-dev \ libgsasl-dev \ - supervisor \ oniguruma-dev \ + libressl \ + libressl-dev \ + supervisor \ procps -RUN docker-php-ext-install mysqli mbstring pdo pdo_mysql tokenizer xml pcntl +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 channel-update pecl.php.net && pecl install memcached-2.2.0 mcrypt-1.0.1 && docker-php-ext-enable memcached \ + 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 && docker-php-ext-enable memcached \ + pecl install memcached mcrypt-1.0.1 && docker-php-ext-enable memcached \ ;fi # Add a non-root user to help install ffmpeg: @@ -158,10 +163,14 @@ RUN set -eux; \ ARG INSTALL_PHPREDIS=false RUN if [ ${INSTALL_PHPREDIS} = true ]; then \ # Install Php Redis Extension - printf "\n" | pecl install -o -f redis \ - && rm -rf /tmp/pear \ - && docker-php-ext-enable redis \ -;fi + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ + printf "\n" | pecl install -o -f redis-4.3.0; \ + else \ + printf "\n" | pecl install -o -f redis; \ + fi; \ + rm -rf /tmp/pear; \ + docker-php-ext-enable redis; \ +fi ARG INSTALL_FFMPEG=false RUN if [ ${INSTALL_FFMPEG} = true ]; then \ @@ -222,9 +231,14 @@ RUN if [ ${INSTALL_CASSANDRA} = true ]; then \ # Install MongoDB drivers: ARG INSTALL_MONGO=false RUN if [ ${INSTALL_MONGO} = true ]; then \ - pecl install mongodb \ - && docker-php-ext-enable mongodb \ - ;fi + 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 ########################################################################### # YAML: extension @@ -235,16 +249,20 @@ ARG INSTALL_YAML=false RUN if [ ${INSTALL_YAML} = true ]; then \ apk --update add -U --no-cache --virtual temp yaml-dev \ && apk add --no-cache yaml \ - && docker-php-source extract \ - && pecl channel-update pecl.php.net \ - && pecl install yaml \ + && docker-php-source extract; \ + if [ $(php -r "echo PHP_MAJOR_VERSION;") = "5" ]; then \ + pecl install yaml-1.3.2; \ + elif [ $(php -r "echo PHP_MAJOR_VERSION;") = "7" ] && [ $(php -r "echo PHP_MINOR_VERSION;") = "0" ]; then \ + pecl install yaml-2.0.4; \ + else \ + pecl install yaml; \ + fi \ && docker-php-ext-enable yaml \ && pecl clear-cache \ && docker-php-source delete \ && apk del temp \ ;fi - ########################################################################### # PHP Memcached: ########################################################################### From 07cd057cec7a59592406d1a8722915a886c08baa Mon Sep 17 00:00:00 2001 From: "Shao Yu-Lung (Allen)" Date: Wed, 7 Apr 2021 21:27:03 +0800 Subject: [PATCH 2/2] extract duplicate command --- laravel-horizon/Dockerfile | 9 +++++---- php-worker/Dockerfile | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/laravel-horizon/Dockerfile b/laravel-horizon/Dockerfile index 198d52f..487366a 100644 --- a/laravel-horizon/Dockerfile +++ b/laravel-horizon/Dockerfile @@ -41,10 +41,11 @@ 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 && docker-php-ext-enable memcached \ -;else \ - pecl install memcached mcrypt-1.0.1 && docker-php-ext-enable memcached \ -;fi + 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 diff --git a/php-worker/Dockerfile b/php-worker/Dockerfile index 3a02f9e..1514c37 100644 --- a/php-worker/Dockerfile +++ b/php-worker/Dockerfile @@ -40,10 +40,11 @@ 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 && docker-php-ext-enable memcached \ -;else \ - pecl install memcached mcrypt-1.0.1 && docker-php-ext-enable memcached \ -;fi + 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