diff options
author | FiveFilters.org <[email protected]> | 2021-08-15 15:35:18 +0200 |
---|---|---|
committer | FiveFilters.org <[email protected]> | 2021-08-15 15:35:18 +0200 |
commit | d536e5f04e135aab3354ca98981a811d03d35d74 (patch) | |
tree | 25d55ff3679dd4e6376712f6fb7ca1d88db091a0 /docker | |
parent | 421964d531d0de464050c4b1ba8d9696acc26ee8 (diff) |
Use pre-built images from Docker Hub for testing
Diffstat (limited to 'docker')
-rw-r--r-- | docker/php/Dockerfile | 49 | ||||
-rw-r--r-- | docker/php/build.Dockerfile | 56 |
2 files changed, 69 insertions, 36 deletions
diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile index 82467bf..e19a366 100644 --- a/docker/php/Dockerfile +++ b/docker/php/Dockerfile @@ -1,39 +1,16 @@ -ARG PHP_VERSION=8 -FROM php:${PHP_VERSION}-cli +# Load pre-built image of PHP (php-cli) and libxml. +# See https://hub.docker.com/r/fivefilters/php-libxml for supported versions +# Use build.Dockerfile to compile new versions of PHP/libxml -# Install sqlite and libonig-dev (required for building PHP 7.4) -RUN apt-get update && apt-get install -y libsqlite3-dev libonig-dev -# Install custom version of libxml2 -RUN apt-get install -y automake libtool unzip libssl-dev -# Remove current version -RUN apt-get remove -y libxml2 -# Download new version, configure and compile -ARG LIBXML_VERSION=2.9.12 -RUN curl https://gitlab.gnome.org/GNOME/libxml2/-/archive/v$LIBXML_VERSION/libxml2-v$LIBXML_VERSION.zip -o /tmp/libxml.zip && \ - cd /tmp && \ - unzip libxml.zip && \ - cd libxml2-v$LIBXML_VERSION && \ - ./autogen.sh --libdir=/usr/lib/x86_64-linux-gnu && \ - make && \ - make install -# Recompile PHP with the new libxml2 library -RUN docker-php-source extract && \ - cd /usr/src/php && \ - ./configure \ - --libdir=/usr/lib/x86_64-linux-gnu \ - --with-libxml \ - --enable-mbstring \ - --with-openssl \ - --with-config-file-path=/usr/local/etc/php \ - --with-config-file-scan-dir=/usr/local/etc/php/conf.d && \ - make && make install && \ - docker-php-source delete +# For reference, default package versions for Ubuntu are: +# Ubuntu 18.04 - php 7.2, libxml 2.9.4 +# Ubuntu 20.04 - php 7.4, libxml 2.9.10 +# Ubuntu 20.10 - php 7.4, libxml 2.9.10 +# Ubuntu 21.04 - php 7.4, libxml 2.9.10 +# Ubuntu 21.10 - php 8.0, libxml 2.9.10 -#RUN apt-get update +ARG PHP_VERSION +ARG LIBXML_VERSION +FROM fivefilters/php-libxml:php-${PHP_VERSION}-libxml-${LIBXML_VERSION} -# Check if there's a pinned version of Xdebug for compatibility reasons -#ARG XDEBUG_VERSION -#RUN pecl install xdebug$(if [ ! ${XDEBUG_VERSION} = '' ]; then echo -${XDEBUG_VERSION} ; fi) && docker-php-ext-enable xdebug - -# Required by coveralls -#RUN apt-get install git -y +RUN apt-get update
\ No newline at end of file diff --git a/docker/php/build.Dockerfile b/docker/php/build.Dockerfile new file mode 100644 index 0000000..270b6d9 --- /dev/null +++ b/docker/php/build.Dockerfile @@ -0,0 +1,56 @@ +# Use this file to build a Docker image using the versions of PHP and Libxml specified. +# We have pre-built images at https://hub.docker.com/r/fivefilters/php-libxml which are faster to load than building from this file. +# To build using this file, use the following command from the root project folder (replace version of PHP/Libxml with the ones you want to use): +# docker build --build-arg PHP_VERSION=7.4 --build-arg LIBXML_VERSION=2.9.12 -t php-libxml -f ./docker/php/Dockerfile . + +# To upload the image to Docker Hub, the tag (-t) value should be something like org/repo:tag, e.g. for us, fivefilters/php-libxml:php-8-libxml-2.9.12 +# The tag can be applied afterwards too, e.g. docker tag php-libxml org/repo:tag + +ARG PHP_VERSION=8 +FROM php:${PHP_VERSION}-cli + +# Install sqlite and libonig-dev (required for building PHP 7.4) +RUN apt-get update && apt-get install -y libsqlite3-dev libonig-dev +# Install libsodium (package doesn't work for some reason) +RUN curl https://download.libsodium.org/libsodium/releases/LATEST.tar.gz -o /tmp/libsodium.tar.gz && \ + cd /tmp && \ + tar -xzf libsodium.tar.gz && \ + cd libsodium-stable/ && \ + ./configure && \ + make && make check && \ + make install +# Install custom version of libxml2 +RUN apt-get install -y automake libtool unzip libssl-dev +# Remove current version +RUN apt-get remove -y libxml2 +# Download new version, configure and compile +ARG LIBXML_VERSION=2.9.12 +RUN curl https://gitlab.gnome.org/GNOME/libxml2/-/archive/v$LIBXML_VERSION/libxml2-v$LIBXML_VERSION.zip -o /tmp/libxml.zip && \ + cd /tmp && \ + unzip libxml.zip && \ + cd libxml2-v$LIBXML_VERSION && \ + ./autogen.sh --libdir=/usr/lib/x86_64-linux-gnu && \ + make && \ + make install +# Recompile PHP with the new libxml2 library +RUN docker-php-source extract && \ + cd /usr/src/php && \ + ./configure \ + --with-libxml \ + --enable-mbstring \ + --with-openssl \ + --with-config-file-path=/usr/local/etc/php \ + --with-config-file-scan-dir=/usr/local/etc/php/conf.d && \ + make && make install && \ + docker-php-source delete + +RUN apt-get update + +#RUN pecl install libsodium + +# Check if there's a pinned version of Xdebug for compatibility reasons +ARG XDEBUG_VERSION +RUN pecl install xdebug$(if [ ! ${XDEBUG_VERSION} = '' ]; then echo -${XDEBUG_VERSION} ; fi) && docker-php-ext-enable xdebug + +# Required by coveralls +RUN apt-get install git -y |