From 21140eab2d4d8972c77ca13cc5d3a946fb0233af Mon Sep 17 00:00:00 2001 From: dimti Date: Wed, 15 Jan 2025 11:17:10 +0300 Subject: [PATCH] * automatic install redis in pecl * correct for dot style version notation of php images tagged and pushed into docker hub --- src/dockerfiles/php/fpm/php.base.Dockerfile | 2 +- .../php/workspace/workspace.base.Dockerfile | 2 +- src/quick/build-php.sh | 21 +++++++++++++++++---- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/dockerfiles/php/fpm/php.base.Dockerfile b/src/dockerfiles/php/fpm/php.base.Dockerfile index 417310c..cc90279 100644 --- a/src/dockerfiles/php/fpm/php.base.Dockerfile +++ b/src/dockerfiles/php/fpm/php.base.Dockerfile @@ -72,7 +72,7 @@ RUN PHP_MAJOR_VERSION=$(php -r 'echo PHP_MAJOR_VERSION;') && \ # Redis: ########################################################################### -RUN pecl install -a redis && \ +RUN echo '' | pecl install redis && \ docker-php-ext-enable redis ########################################################################### diff --git a/src/dockerfiles/php/workspace/workspace.base.Dockerfile b/src/dockerfiles/php/workspace/workspace.base.Dockerfile index 7a457dd..85efc03 100644 --- a/src/dockerfiles/php/workspace/workspace.base.Dockerfile +++ b/src/dockerfiles/php/workspace/workspace.base.Dockerfile @@ -49,7 +49,7 @@ RUN PHP_MAJOR_VERSION=$(php -r 'echo PHP_MAJOR_VERSION;') && \ # Redis: ########################################################################### -RUN pecl install -a redis && \ +RUN echo '' | pecl install redis && \ echo "extension=redis.so" > /etc/php/${PHP_VERSION}/cli/conf.d/20-redis.ini ########################################################################### diff --git a/src/quick/build-php.sh b/src/quick/build-php.sh index fa28db2..289d993 100644 --- a/src/quick/build-php.sh +++ b/src/quick/build-php.sh @@ -9,13 +9,20 @@ set -e ONLY_PUSH=$2 +function dot_version() { + sed -r 's/^([[:digit:]])/\1./g' <<< $1 +} + if [ -z "${ONLY_PUSH}" ]; then for PHP_VERSION in "${PHP_VERSIONS[@]}"; do + PHP_IMAGE=$(dot_version "${PHP_VERSION}") + + echo $PHP_IMAGE docker-compose build "php${PHP_VERSION}" && \ - docker tag "src-php${PHP_VERSION}" "dimti/php:${PHP_VERSION}" + docker tag "src-php${PHP_VERSION}" "dimti/php:${PHP_IMAGE}" docker-compose build "workspace${PHP_VERSION}" && \ - docker tag "src-workspace${PHP_VERSION}" "dimti/workspace:${PHP_VERSION}" + docker tag "src-workspace${PHP_VERSION}" "dimti/workspace:${PHP_IMAGE}" done fi @@ -23,7 +30,13 @@ WITH_PUSH=$1 if [ -n "${WITH_PUSH}" ]; then for PHP_VERSION in "${PHP_VERSIONS[@]}"; do - docker push "dimti/php:${PHP_VERSION}" - docker push "dimti/workspace:${PHP_VERSION}" + PHP_IMAGE=$(dot_version "${PHP_VERSION}") + + echo "Push $PHP_IMAGE" + echo + + docker push "dimti/php:${PHP_IMAGE}" && \ + docker push "dimti/workspace:${PHP_IMAGE}" + echo done fi