From bf06118a1ad77fe6b1aeaf3cfe7c906680abf725 Mon Sep 17 00:00:00 2001 From: J0WI Date: Fri, 23 Nov 2018 15:06:57 +0100 Subject: [PATCH] Update pecl extensions in update.sh --- Dockerfile-alpine.template | 6 +++--- Dockerfile-debian.template | 6 +++--- update.sh | 29 +++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+), 6 deletions(-) diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index 72ca3ca9..d2d45ef4 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -28,9 +28,9 @@ RUN set -ex; \ ; \ \ # pecl will claim success even if one install fails, so we need to perform each install separately - pecl install APCu-5.1.14; \ - pecl install geoip-1.1.1; \ - pecl install redis-3.1.6; \ + pecl install APCu-%%APCU_VERSION%%; \ + pecl install geoip-%%GEOIP_VERSION%%; \ + pecl install redis-%%REDIS_VERSION%%; \ \ docker-php-ext-enable \ apcu \ diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index bbe42857..94c642f8 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -28,9 +28,9 @@ RUN set -ex; \ ; \ \ # pecl will claim success even if one install fails, so we need to perform each install separately - pecl install APCu-5.1.14; \ - pecl install geoip-1.1.1; \ - pecl install redis-3.1.6; \ + pecl install APCu-%%APCU_VERSION%%; \ + pecl install geoip-%%GEOIP_VERSION%%; \ + pecl install redis-%%REDIS_VERSION%%; \ \ docker-php-ext-enable \ apcu \ diff --git a/update.sh b/update.sh index 3d4d8143..9c4ccfc3 100755 --- a/update.sh +++ b/update.sh @@ -21,6 +21,32 @@ latest="$( | tail -1 )" +apcu_version="$( + git ls-remote --tags https://github.com/krakjoe/apcu.git \ + | cut -d/ -f3 \ + | grep -vE -- '-rc|-b' \ + | sed -E 's/^v//' \ + | sort -V \ + | tail -1 +)" + +# Todo: check for 4.x compatibility +redis_version="$( + git ls-remote --tags https://github.com/phpredis/phpredis.git \ + | cut -d/ -f3 \ + | grep -viE '[a-z]' \ + | tr -d '^{}' \ + | grep -E '^3\.' \ + | sort -V \ + | tail -1 +)" + +declare -A pecl_versions=( + [APCu]="$apcu_version" + [geoip]="1.1.1" # Todo: fetch latest tag from SVN repo + [redis]="$redis_version" +) + set -x for variant in apache fpm fpm-alpine; do @@ -31,6 +57,9 @@ for variant in apache fpm fpm-alpine; do sed -ri -e ' s/%%VARIANT%%/'"$variant"'/; s/%%VERSION%%/'"$latest"'/; + s/%%APCU_VERSION%%/'"${pecl_versions[APCu]}"'/g; + s/%%GEOIP_VERSION%%/'"${pecl_versions[geoip]}"'/g; + s/%%REDIS_VERSION%%/'"${pecl_versions[redis]}"'/g; s/%%CMD%%/'"${cmd[$variant]}"'/; ' "$variant/Dockerfile" done