From d2dcf7bcc5fe5cb13ca9baa5669b611f8c6f60cb Mon Sep 17 00:00:00 2001 From: Alexandre Quercia Date: Sat, 20 Jan 2024 17:37:15 +0100 Subject: [PATCH] fix(test): make php 5.3 consistent with others --- .docker/php53/Dockerfile | 95 +++++++++++++++++++++++++++++++++---- .docker/php54/Dockerfile | 40 +++++++++++----- .docker/php55_71/Dockerfile | 39 ++++++++------- .docker/php72_73/Dockerfile | 34 +++++++------ .docker/php74_83/Dockerfile | 32 +++++++------ docker-compose.yml | 72 +++++++++++----------------- 6 files changed, 200 insertions(+), 112 deletions(-) diff --git a/.docker/php53/Dockerfile b/.docker/php53/Dockerfile index daa7b9214..7357b4e48 100644 --- a/.docker/php53/Dockerfile +++ b/.docker/php53/Dockerfile @@ -12,11 +12,15 @@ RUN set -eux; \ # php 5.3 needs older autoconf RUN set -eux; \ + \ + buildDeps=' \ + autoconf2.13 \ + '; \ \ apt-get update; \ apt-get install -y --force-yes --no-upgrade --no-install-recommends \ curl \ - autoconf2.13 \ + $buildDeps \ ; \ rm -r /var/lib/apt/lists/*; \ \ @@ -37,23 +41,45 @@ RUN set -eux; \ ./buildconf --force; \ ./configure --disable-cgi \ $(command -v apxs2 > /dev/null 2>&1 && echo '--with-apxs2' || true) \ + --with-config-file-path=/usr/local/etc/php \ + --with-config-file-scan-dir=/usr/local/etc/php/conf.d \ + --with-libdir=lib/x86_64-linux-gnu \ --with-pdo-mysql \ --with-zlib \ + --enable-zip \ --enable-mbstring \ --with-openssl=/usr \ - --with-libdir=lib/x86_64-linux-gnu \ + --enable-mysqlnd \ + --with-curl \ + --with-readline \ + --enable-ftp \ ; \ make -j"$(nproc)"; \ make install; \ + install -d /usr/local/etc/php/conf.d; \ \ dpkg -r \ bison \ libbison-dev \ ; \ - apt-get purge -y --force-yes --auto-remove \ - autoconf2.13 \ + apt-get purge -y --force-yes --auto-remove -o APT::AutoRemove::RecommendsImportant=true \ + $buildDeps \ ; \ - rm -r /usr/src/php + rm -r /usr/src/php; \ + apt-get clean; \ + rm -rf /var/lib/apt/lists/*; \ + rm -r /tmp/pear; \ + :; + +RUN set -eux; \ + { \ + echo '#! /bin/sh -eu'; \ + echo ''; \ + echo 'echo "extension=${1}.so" > "/usr/local/etc/php/conf.d/docker-php-ext-${1}.ini";'; \ + } | tee /usr/local/bin/docker-php-ext-enable; \ + \ + chmod +x /usr/local/bin/docker-php-ext-enable; \ + :; CMD ["php", "-a"] @@ -61,14 +87,21 @@ FROM php53 # Install APC PHP extension # +ARG APC_VERSION RUN set -eux; \ \ - packageName=APC; \ - packageVersion=3.1.13; \ + packageName=apc; \ + packageVersion=${APC_VERSION}; \ + packageFile=APC-${packageVersion}.tgz; \ \ - packageFile=${packageName}-${packageVersion}.tgz; \ + if test x"3.1.13" = x"${packageVersion}"; then \ + packageSha256sum=5ef8ba07729e72946e95951672a5378bed98cb5a294e79bf0f0a97ac62829abd; \ + else :; fi; \ \ - packageSha256sum=5ef8ba07729e72946e95951672a5378bed98cb5a294e79bf0f0a97ac62829abd; \ + if test x"" = x"${packageVersion}"; then \ + echo "Skip installation of ${packageName} PHP extension"; \ + return 0; \ + fi; \ \ curl --insecure -sSLfO https://pecl.php.net/get/${packageFile}; \ echo "${packageSha256sum} ${packageFile}" \ @@ -77,11 +110,53 @@ RUN set -eux; \ pecl install ${packageFile}; \ rm ${packageFile}; \ \ - echo "extension=apc.so" >> /usr/local/lib/php.ini; \ + docker-php-ext-enable ${packageName}; \ \ rm -r /tmp/pear; \ :; +# Install memcache PHP extension +# +ARG MEMCACHE_VERSION +RUN set -eux; \ + \ + packageName=memcache; \ + packageVersion=${MEMCACHE_VERSION}; \ + packageFile=${packageName}-${packageVersion}.tgz; \ + \ + if test x"3.0.8" = x"${packageVersion}"; then \ + packageSha256sum=2cae5b423ffbfd33a259829849f6000d4db018debe3e29ecf3056f06642e8311; \ + else :; fi; \ + \ + if test x"" = x"${packageVersion}"; then \ + echo "Skip installation of ${packageName} PHP extension"; \ + return 0; \ + fi; \ + \ + buildDeps=' \ + libzip-dev \ + '; \ + apt-get update; \ + apt-get install -y --force-yes --no-upgrade --no-install-recommends \ + $buildDeps \ + ; \ + \ + curl --insecure -sSLfO https://pecl.php.net/get/${packageFile}; \ + echo "${packageSha256sum} ${packageFile}" \ + | sha256sum -cw --status; \ + \ + pecl install ${packageFile}; \ + rm ${packageFile}; \ + \ + docker-php-ext-enable ${packageName}; \ + \ + apt-get purge -y --force-yes --auto-remove -o APT::AutoRemove::RecommendsImportant=true \ + $buildDeps \ + ; \ + apt-get clean; \ + rm -rf /var/lib/apt/lists/*; \ + rm -r /tmp/pear + # Install composer # RUN set -eux; \ diff --git a/.docker/php54/Dockerfile b/.docker/php54/Dockerfile index 62a792b9a..e7b624265 100644 --- a/.docker/php54/Dockerfile +++ b/.docker/php54/Dockerfile @@ -24,14 +24,21 @@ RUN docker-php-ext-install mbstring # Install APC PHP extension # +ARG APC_VERSION RUN set -eux; \ \ - packageName=APC; \ - packageVersion=3.1.13; \ + packageName=apc; \ + packageVersion=${APC_VERSION}; \ + packageFile=APC-${packageVersion}.tgz; \ \ - packageFile=${packageName}-${packageVersion}.tgz; \ + if test x"3.1.13" = x"${packageVersion}"; then \ + packageSha256sum=5ef8ba07729e72946e95951672a5378bed98cb5a294e79bf0f0a97ac62829abd; \ + else :; fi; \ \ - packageSha256sum=5ef8ba07729e72946e95951672a5378bed98cb5a294e79bf0f0a97ac62829abd; \ + if test x"" = x"${packageVersion}"; then \ + echo "Skip installation of ${packageName} PHP extension"; \ + return 0; \ + fi; \ \ curl --insecure -sSLfO https://pecl.php.net/get/${packageFile}; \ echo "${packageSha256sum} ${packageFile}" \ @@ -40,7 +47,7 @@ RUN set -eux; \ pecl install ${packageFile}; \ rm ${packageFile}; \ \ - echo "extension=apc.so" >> /usr/local/lib/php.ini; \ + docker-php-ext-enable ${packageName}; \ \ rm -r /tmp/pear; \ :; @@ -50,10 +57,19 @@ RUN set -eux; \ ARG MEMCACHE_VERSION RUN set -eux; \ \ - if test x"3.0.8" = x"${MEMCACHE_VERSION}"; then \ - packageSha256sum=2cae5b423ffbfd33a259829849f6000d4db018debe3e29ecf3056f06642e8311; \ + packageName=memcache; \ + packageVersion=${MEMCACHE_VERSION}; \ + packageFile=${packageName}-${packageVersion}.tgz; \ + \ + if test x"3.0.8" = x"${packageVersion}"; then \ + packageSha256sum=2cae5b423ffbfd33a259829849f6000d4db018debe3e29ecf3056f06642e8311; \ else :; fi; \ \ + if test x"" = x"${packageVersion}"; then \ + echo "Skip installation of ${packageName} PHP extension"; \ + return 0; \ + fi; \ + \ buildDeps=' \ libzip-dev \ '; \ @@ -62,14 +78,14 @@ RUN set -eux; \ $buildDeps \ ; \ \ - curl --insecure -sSLfO https://pecl.php.net/get/memcache-${MEMCACHE_VERSION}.tgz; \ - echo "${packageSha256sum} memcache-${MEMCACHE_VERSION}.tgz" \ + curl --insecure -sSLfO https://pecl.php.net/get/${packageFile}; \ + echo "${packageSha256sum} ${packageFile}" \ | sha256sum -cw --status; \ \ - pecl install memcache-${MEMCACHE_VERSION}.tgz; \ - rm memcache-${MEMCACHE_VERSION}.tgz; \ + pecl install ${packageFile}; \ + rm ${packageFile}; \ \ - docker-php-ext-enable memcache; \ + docker-php-ext-enable ${packageName}; \ \ apt-get purge -y --force-yes --auto-remove -o APT::AutoRemove::RecommendsImportant=true \ $buildDeps \ diff --git a/.docker/php55_71/Dockerfile b/.docker/php55_71/Dockerfile index 0f2c57c14..49f5740f4 100644 --- a/.docker/php55_71/Dockerfile +++ b/.docker/php55_71/Dockerfile @@ -27,14 +27,9 @@ RUN docker-php-ext-install mbstring # ARG APCU_VERSION RUN set -eux; \ - \ - if test x"" = x"${APCU_VERSION}"; then \ - return 0; \ - else :; fi; \ \ packageName=apcu; \ packageVersion=${APCU_VERSION}; \ - \ packageFile=${packageName}-${packageVersion}.tgz; \ \ if test x"4.0.11" = x"${packageVersion}"; then \ @@ -45,6 +40,11 @@ RUN set -eux; \ packageSha256sum=67ee7464ccad2335c3fa4aeb0b8edbcf6d8344feea7922620c6a13015d604482; \ else :; fi; \ \ + if test x"" = x"${packageVersion}"; then \ + echo "Skip installation of ${packageName} PHP extension"; \ + return 0; \ + fi; \ + \ curl --insecure -sSLfO https://pecl.php.net/get/${packageFile}; \ echo "${packageSha256sum} ${packageFile}" \ | sha256sum -cw --status; \ @@ -61,27 +61,32 @@ RUN set -eux; \ # ARG MEMCACHE_VERSION RUN set -eux; \ - \ - buildDeps=' \ - libzip-dev \ - '; \ - apt-get update; \ - apt-get install -y --force-yes --no-upgrade --no-install-recommends \ - $buildDeps \ - ; \ \ packageName=memcache; \ packageVersion=${MEMCACHE_VERSION}; \ - \ packageFile=${packageName}-${packageVersion}.tgz; \ \ - if test x"4.0.5.2" = x"${packageVersion}"; then \ - packageSha256sum=7b7667813baea003671f174bbec849e43ff235a8ea4ab7e36c3a0380c2a9ed63; \ - else :; fi; \ if test x"3.0.8" = x"${packageVersion}"; then \ packageSha256sum=2cae5b423ffbfd33a259829849f6000d4db018debe3e29ecf3056f06642e8311; \ else :; fi; \ \ + if test x"4.0.5.2" = x"${packageVersion}"; then \ + packageSha256sum=7b7667813baea003671f174bbec849e43ff235a8ea4ab7e36c3a0380c2a9ed63; \ + else :; fi; \ + \ + if test x"" = x"${packageVersion}"; then \ + echo "Skip installation of ${packageName} PHP extension"; \ + return 0; \ + fi; \ + \ + buildDeps=' \ + libzip-dev \ + '; \ + apt-get update; \ + apt-get install -y --force-yes --no-upgrade --no-install-recommends \ + $buildDeps \ + ; \ + \ curl --insecure -sSLfO https://pecl.php.net/get/${packageFile}; \ echo "${packageSha256sum} ${packageFile}" \ | sha256sum -cw --status; \ diff --git a/.docker/php72_73/Dockerfile b/.docker/php72_73/Dockerfile index 42765befb..ebbaef7b3 100644 --- a/.docker/php72_73/Dockerfile +++ b/.docker/php72_73/Dockerfile @@ -9,20 +9,20 @@ RUN docker-php-ext-install mbstring # ARG APCU_VERSION RUN set -eux; \ - \ - if test x"" = x"${APCU_VERSION}"; then \ - return 0; \ - else :; fi; \ \ packageName=apcu; \ packageVersion=${APCU_VERSION}; \ - \ packageFile=${packageName}-${packageVersion}.tgz; \ \ if test x"5.1.23" = x"${packageVersion}"; then \ packageSha256sum=67ee7464ccad2335c3fa4aeb0b8edbcf6d8344feea7922620c6a13015d604482; \ else :; fi; \ \ + if test x"" = x"${packageVersion}"; then \ + echo "Skip installation of ${packageName} PHP extension"; \ + return 0; \ + fi; \ + \ curl --insecure -sSLfO https://pecl.php.net/get/${packageFile}; \ echo "${packageSha256sum} ${packageFile}" \ | sha256sum -cw --status; \ @@ -39,24 +39,28 @@ RUN set -eux; \ # ARG MEMCACHE_VERSION RUN set -eux; \ - \ - buildDeps=' \ - libzip-dev \ - '; \ - apt-get update; \ - apt-get install -y --force-yes --no-upgrade --no-install-recommends \ - $buildDeps \ - ; \ \ packageName=memcache; \ packageVersion=${MEMCACHE_VERSION}; \ - \ packageFile=${packageName}-${packageVersion}.tgz; \ \ if test x"4.0.5.2" = x"${packageVersion}"; then \ packageSha256sum=7b7667813baea003671f174bbec849e43ff235a8ea4ab7e36c3a0380c2a9ed63; \ else :; fi; \ \ + if test x"" = x"${packageVersion}"; then \ + echo "Skip installation of ${packageName} PHP extension"; \ + return 0; \ + fi; \ + \ + buildDeps=' \ + libzip-dev \ + '; \ + apt-get update; \ + apt-get install -y --force-yes --no-upgrade --no-install-recommends \ + $buildDeps \ + ; \ + \ curl --insecure -sSLfO https://pecl.php.net/get/${packageFile}; \ echo "${packageSha256sum} ${packageFile}" \ | sha256sum -cw --status; \ @@ -66,7 +70,7 @@ RUN set -eux; \ \ docker-php-ext-enable ${packageName}; \ \ - apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=true \ + apt-get purge -y --force-yes --auto-remove -o APT::AutoRemove::RecommendsImportant=true \ $buildDeps \ ; \ apt-get clean; \ diff --git a/.docker/php74_83/Dockerfile b/.docker/php74_83/Dockerfile index a55823563..2336ef90d 100644 --- a/.docker/php74_83/Dockerfile +++ b/.docker/php74_83/Dockerfile @@ -21,20 +21,20 @@ RUN set -eux; \ # ARG APCU_VERSION RUN set -eux; \ - \ - if test x"" = x"${APCU_VERSION}"; then \ - return 0; \ - else :; fi; \ \ packageName=apcu; \ packageVersion=${APCU_VERSION}; \ - \ packageFile=${packageName}-${packageVersion}.tgz; \ \ if test x"5.1.23" = x"${packageVersion}"; then \ packageSha256sum=67ee7464ccad2335c3fa4aeb0b8edbcf6d8344feea7922620c6a13015d604482; \ else :; fi; \ \ + if test x"" = x"${packageVersion}"; then \ + echo "Skip installation of ${packageName} PHP extension"; \ + return 0; \ + fi; \ + \ curl --insecure -sSLfO https://pecl.php.net/get/${packageFile}; \ echo "${packageSha256sum} ${packageFile}" \ | sha256sum -cw --status; \ @@ -51,18 +51,9 @@ RUN set -eux; \ # ARG MEMCACHE_VERSION RUN set -eux; \ - \ - buildDeps=' \ - libzip-dev \ - '; \ - apt-get update; \ - apt-get install -y --force-yes --no-upgrade --no-install-recommends \ - $buildDeps \ - ; \ \ packageName=memcache; \ packageVersion=${MEMCACHE_VERSION}; \ - \ packageFile=${packageName}-${packageVersion}.tgz; \ \ if test x"4.0.5.2" = x"${packageVersion}"; then \ @@ -77,6 +68,19 @@ RUN set -eux; \ packageSha256sum=b3f0640eacdeb9046c6c86a1546d7fb8a4e9f219e5d9a36a287e59b2dd8208e5; \ else :; fi; \ \ + if test x"" = x"${packageVersion}"; then \ + echo "Skip installation of ${packageName} PHP extension"; \ + return 0; \ + fi; \ + \ + buildDeps=' \ + libzip-dev \ + '; \ + apt-get update; \ + apt-get install -y --force-yes --no-upgrade --no-install-recommends \ + $buildDeps \ + ; \ + \ curl --insecure -sSLfO https://pecl.php.net/get/${packageFile}; \ echo "${packageSha256sum} ${packageFile}" \ | sha256sum -cw --status; \ diff --git a/docker-compose.yml b/docker-compose.yml index b2466a08a..71a58ef70 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -4,14 +4,19 @@ volumes: db_socket: services: - php53: - build: .docker/php53 - working_dir: /app/tests + php53: &services_php + build: + context: .docker/php53 + args: + MEMCACHE_VERSION: '3.0.8' + APC_VERSION: '3.1.13' + working_dir: /app volumes: - .:/app - db_socket:/var/run/mysqld environment: COMPOSER_HOME: /app/var/cache/composer + MEMCACHED_HOST: memcached entrypoint: - sh - -c @@ -23,46 +28,24 @@ services: echo 'magic_quotes_gpc = off' echo 'date.timezone = "UTC"' echo 'apc.enable_cli = on' - echo 'apc.use_request_time = 0' - } | tee -a /usr/local/lib/php.ini + echo 'apc.use_request_time = off' + } | tee -a /usr/local/etc/php/php.ini exec tail -f /dev/null depends_on: - db + - memcached - php54: &services_php54 + php54: + <<: *services_php build: context: .docker/php54 args: MEMCACHE_VERSION: '3.0.8' - environment: - MEMCACHED_HOST: memcached - COMPOSER_HOME: /app/var/cache/composer - working_dir: /app/tests - volumes: - - .:/app - - db_socket:/var/run/mysqld - entrypoint: - - sh - - -c - - | - { - echo 'pdo_mysql.default_socket = /var/run/mysqld/mysql.sock' - echo 'memory_limit = -1' - echo 'short_open_tag = off' - echo 'magic_quotes_gpc = off' - echo 'date.timezone = "UTC"' - echo 'apc.enable_cli = on' - echo 'apc.use_request_time = 0' - } | tee -a /usr/local/etc/php/php.ini - - exec tail -f /dev/null - depends_on: - - db - - memcached + APC_VERSION: '3.1.13' php55: - <<: *services_php54 + <<: *services_php build: context: .docker/php55_71 args: @@ -71,7 +54,7 @@ services: APCU_VERSION: '4.0.11' php56: - <<: *services_php54 + <<: *services_php build: context: .docker/php55_71 args: @@ -80,7 +63,7 @@ services: APCU_VERSION: '4.0.11' php70: - <<: *services_php54 + <<: *services_php build: context: .docker/php55_71 args: @@ -89,7 +72,7 @@ services: APCU_VERSION: '' php71: - <<: *services_php54 + <<: *services_php build: context: .docker/php55_71 args: @@ -98,7 +81,7 @@ services: APCU_VERSION: '' php72: - <<: *services_php54 + <<: *services_php build: context: .docker/php72_73 args: @@ -107,7 +90,7 @@ services: APCU_VERSION: '' php73: - <<: *services_php54 + <<: *services_php build: context: .docker/php72_73 args: @@ -116,7 +99,7 @@ services: APCU_VERSION: '' php74: - <<: *services_php54 + <<: *services_php build: context: .docker/php74_83 args: @@ -125,7 +108,7 @@ services: APCU_VERSION: '' php80: - <<: *services_php54 + <<: *services_php build: context: .docker/php74_83 args: @@ -134,7 +117,7 @@ services: APCU_VERSION: '' php81: - <<: *services_php54 + <<: *services_php build: context: .docker/php74_83 args: @@ -143,23 +126,24 @@ services: APCU_VERSION: '' php82: - <<: *services_php54 + <<: *services_php build: context: .docker/php74_83 args: PHP_VERSION: '8.2' - MEMCACHE_VERSION: '8.0' + MEMCACHE_VERSION: '8.2' APCU_VERSION: '' php83: - <<: *services_php54 + <<: *services_php build: context: .docker/php74_83 args: PHP_VERSION: '8.3' - MEMCACHE_VERSION: '8.0' + MEMCACHE_VERSION: '8.2' APCU_VERSION: '' + db: image: mysql:5.5.62 environment: