Skip to content

Commit

Permalink
Fix docker images build to handle old linux distributions
Browse files Browse the repository at this point in the history
  • Loading branch information
alquerci committed Dec 28, 2023
1 parent 0978095 commit a4c1e4d
Show file tree
Hide file tree
Showing 10 changed files with 733 additions and 112 deletions.
65 changes: 61 additions & 4 deletions .docker/php53/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,12 +1,20 @@
FROM buildpack-deps:jessie
FROM buildpack-deps:jessie as php53

ENV PHP_VERSION 5.3.29

RUN set -eux; \
codename='jessie'; \
{ \
echo "deb http://archive.debian.org/debian ${codename} main"; \
echo "deb http://archive.debian.org/debian ${codename}-backports main"; \
echo "deb http://archive.debian.org/debian-security ${codename}/updates main"; \
} > /etc/apt/sources.list;

# php 5.3 needs older autoconf
RUN set -eux; \
\
apt-get update; \
apt-get install -y \
apt-get install -y --force-yes --no-upgrade --no-install-recommends \
curl \
autoconf2.13 \
; \
Expand All @@ -18,7 +26,7 @@ RUN set -eux; \
dpkg -i bison_2.7.1.dfsg-1_amd64.deb; \
rm *.deb; \
\
curl -sSLf "https://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2; \
curl --insecure -sSLf "https://php.net/get/php-$PHP_VERSION.tar.bz2/from/this/mirror" -o php.tar.bz2; \
echo 'c4e1cf6972b2a9c7f2777a18497d83bf713cdbecabb65d3ff62ba441aebb0091 php.tar.bz2' | sha256sum -cw --status; \
\
mkdir -p /usr/src/php; \
Expand All @@ -32,6 +40,8 @@ RUN set -eux; \
--with-pdo-mysql \
--with-zlib \
--enable-mbstring \
--with-openssl=/usr \
--with-libdir=lib/x86_64-linux-gnu \
; \
make -j"$(nproc)"; \
make install; \
Expand All @@ -40,9 +50,56 @@ RUN set -eux; \
bison \
libbison-dev \
; \
apt-get purge -y --auto-remove \
apt-get purge -y --force-yes --auto-remove \
autoconf2.13 \
; \
rm -r /usr/src/php

CMD ["php", "-a"]

FROM php53

# Install APC PHP extension
#
RUN set -eux; \
\
pecl install apc-3.1.13; \
echo 'extension=apc.so' >> /usr/local/lib/php.ini; \
\
rm -r /tmp/pear;

# Install composer
#
RUN set -eux; \
composerVersion='1.10.27'; \
installerUrl='https://raw.githubusercontent.com/composer/getcomposer.org/a19025d6c0a1ff9fc1fac341128b2823193be462/web/installer'; \
\
curl --insecure -sSLf "${installerUrl}" -o /usr/local/bin/composer-installer.php; \
echo '203196aedb1a3b0f563363796bbf6f647a4f8c2419bc1dfc5aa45adc1725025d /usr/local/bin/composer-installer.php' \
| sha256sum -cw --status; \
\
{ \
echo '#! /usr/bin/env php'; \
cat /usr/local/bin/composer-installer.php; \
} > /usr/local/bin/composer-installer; \
rm /usr/local/bin/composer-installer.php; \
chmod +x /usr/local/bin/composer-installer; \
\
composer-installer \
--disable-tls \
--version="${composerVersion}" \
--filename=composer \
--install-dir=/usr/local/bin \
; \
\
echo '230d28fb29f3c6c07ab2382390bef313e36de17868b2bd23b2e070554cae23d2 /usr/local/bin/composer' \
| sha256sum -cw --status; \
\
composer --version; \
\
apt-get update; \
apt-get install -y --force-yes --no-upgrade --no-install-recommends \
git \
; \
rm -r /var/lib/apt/lists/*; \
:;
87 changes: 87 additions & 0 deletions .docker/php54/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,92 @@
FROM php:5.4-cli

RUN set -eux; \
codename='jessie'; \
{ \
echo "deb http://archive.debian.org/debian ${codename} main"; \
echo "deb http://archive.debian.org/debian ${codename}-backports main"; \
echo "deb http://archive.debian.org/debian-security ${codename}/updates main"; \
} > /etc/apt/sources.list;

RUN set -eux; \
apt-get update; \
apt-get install -y --force-yes --no-upgrade --no-install-recommends \
ca-certificates \
; \
\
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
:;

RUN docker-php-ext-install pdo
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install mbstring

# Install APC PHP extension
#
RUN set -eux; \
pecl install apc-3.1.13; \
docker-php-ext-enable apc; \
rm -r /tmp/pear;

# Install memcache PHP extension
#
ARG MEMCACHE_VERSION
RUN set -eux; \
buildDeps=' \
libzip-dev \
'; \
apt-get update; \
apt-get install -y --force-yes --no-upgrade --no-install-recommends \
$buildDeps \
; \
\
pecl install memcache-${MEMCACHE_VERSION}; \
docker-php-ext-enable memcache; \
\
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; \
composerVersion='1.10.27'; \
installerUrl='https://raw.githubusercontent.com/composer/getcomposer.org/a19025d6c0a1ff9fc1fac341128b2823193be462/web/installer'; \
\
curl --insecure -sSLf "${installerUrl}" -o /usr/local/bin/composer-installer.php; \
echo '203196aedb1a3b0f563363796bbf6f647a4f8c2419bc1dfc5aa45adc1725025d /usr/local/bin/composer-installer.php' \
| sha256sum -cw --status; \
\
{ \
echo '#! /usr/bin/env php'; \
cat /usr/local/bin/composer-installer.php; \
} > /usr/local/bin/composer-installer; \
rm /usr/local/bin/composer-installer.php; \
chmod +x /usr/local/bin/composer-installer; \
\
composer-installer \
--disable-tls \
--version="${composerVersion}" \
--filename=composer \
--install-dir=/usr/local/bin \
; \
\
echo '230d28fb29f3c6c07ab2382390bef313e36de17868b2bd23b2e070554cae23d2 /usr/local/bin/composer' \
| sha256sum -cw --status; \
\
composer --version; \
\
apt-get update; \
apt-get install -y --force-yes --no-upgrade --no-install-recommends \
git \
libzip-dev \
unzip \
; \
rm -r /var/lib/apt/lists/*; \
\
docker-php-ext-install zip; \
:;
92 changes: 92 additions & 0 deletions .docker/php55_71/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,98 @@
ARG PHP_TAG
FROM php:${PHP_TAG}

RUN set -eux; \
codename='jessie'; \
{ \
echo "deb http://archive.debian.org/debian ${codename} main"; \
echo "deb http://archive.debian.org/debian ${codename}-backports main"; \
echo "deb http://archive.debian.org/debian-security ${codename}/updates main"; \
} > /etc/apt/sources.list;

RUN set -eux; \
apt-get update; \
apt-get install -y --force-yes --no-upgrade --no-install-recommends \
ca-certificates \
; \
\
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
:;

RUN docker-php-ext-install pdo
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install mbstring

# Install APCu PHP extension
#
ARG APCU_VERSION
RUN set -eux; \
\
test x"" = x"${APCU_VERSION}" || { \
pecl install apcu-${APCU_VERSION}; \
docker-php-ext-enable apcu; \
\
rm -r /tmp/pear; \
}

# Install memcache PHP extension
#
ARG MEMCACHE_VERSION
RUN set -eux; \
buildDeps=' \
libzip-dev \
'; \
apt-get update; \
apt-get install -y --force-yes --no-upgrade --no-install-recommends \
$buildDeps \
; \
\
pecl install memcache-${MEMCACHE_VERSION}; \
docker-php-ext-enable memcache; \
\
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; \
composerVersion='1.10.27'; \
installerUrl='https://raw.githubusercontent.com/composer/getcomposer.org/a19025d6c0a1ff9fc1fac341128b2823193be462/web/installer'; \
\
curl --insecure -sSLf "${installerUrl}" -o /usr/local/bin/composer-installer.php; \
echo '203196aedb1a3b0f563363796bbf6f647a4f8c2419bc1dfc5aa45adc1725025d /usr/local/bin/composer-installer.php' \
| sha256sum -cw --status; \
\
{ \
echo '#! /usr/bin/env php'; \
cat /usr/local/bin/composer-installer.php; \
} > /usr/local/bin/composer-installer; \
rm /usr/local/bin/composer-installer.php; \
chmod +x /usr/local/bin/composer-installer; \
\
composer-installer \
--disable-tls \
--version="${composerVersion}" \
--filename=composer \
--install-dir=/usr/local/bin \
; \
\
echo '230d28fb29f3c6c07ab2382390bef313e36de17868b2bd23b2e070554cae23d2 /usr/local/bin/composer' \
| sha256sum -cw --status; \
\
composer --version; \
\
apt-get update; \
apt-get install -y --force-yes --no-upgrade --no-install-recommends \
git \
libzip-dev \
unzip \
; \
rm -r /var/lib/apt/lists/*; \
\
docker-php-ext-install zip; \
:;
74 changes: 74 additions & 0 deletions .docker/php72_73/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,40 @@ RUN docker-php-ext-install pdo
RUN docker-php-ext-install pdo_mysql
RUN docker-php-ext-install mbstring

# Install APCu PHP extension
#
ARG APCU_VERSION
RUN set -eux; \
\
test x"" = x"${APCU_VERSION}" || { \
pecl install apcu-${APCU_VERSION}; \
docker-php-ext-enable apcu; \
\
rm -r /tmp/pear; \
}

# Install memcache PHP extension
#
ARG MEMCACHE_VERSION
RUN set -eux; \
buildDeps=' \
libzip-dev \
'; \
apt-get update; \
apt-get install -y --force-yes --no-upgrade --no-install-recommends \
$buildDeps \
; \
\
pecl install memcache-${MEMCACHE_VERSION}; \
docker-php-ext-enable memcache; \
\
apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=true \
$buildDeps \
; \
apt-get clean; \
rm -rf /var/lib/apt/lists/*; \
rm -r /tmp/pear

# For consistent mime type file guesser
RUN set -eux; \
distFilePath=`which file`; \
Expand All @@ -20,3 +54,43 @@ RUN set -eux; \
\
file /bin/ls --mime | grep application/x-executable; \
:;

# Install composer
#
RUN set -eux; \
composerVersion='1.10.27'; \
installerUrl='https://raw.githubusercontent.com/composer/getcomposer.org/a19025d6c0a1ff9fc1fac341128b2823193be462/web/installer'; \
\
curl --insecure -sSLf "${installerUrl}" -o /usr/local/bin/composer-installer.php; \
echo '203196aedb1a3b0f563363796bbf6f647a4f8c2419bc1dfc5aa45adc1725025d /usr/local/bin/composer-installer.php' \
| sha256sum -cw --status; \
\
{ \
echo '#! /usr/bin/env php'; \
cat /usr/local/bin/composer-installer.php; \
} > /usr/local/bin/composer-installer; \
rm /usr/local/bin/composer-installer.php; \
chmod +x /usr/local/bin/composer-installer; \
\
composer-installer \
--disable-tls \
--version="${composerVersion}" \
--filename=composer \
--install-dir=/usr/local/bin \
; \
\
echo '230d28fb29f3c6c07ab2382390bef313e36de17868b2bd23b2e070554cae23d2 /usr/local/bin/composer' \
| sha256sum -cw --status; \
\
composer --version; \
\
apt-get update; \
apt-get install -y --force-yes --no-upgrade --no-install-recommends \
git \
libzip-dev \
unzip \
; \
rm -r /var/lib/apt/lists/*; \
\
docker-php-ext-install zip; \
:;
Loading

0 comments on commit a4c1e4d

Please sign in to comment.