From 4d09bc45cb4849edfb4e22aac5b47ddef97b79c7 Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Mon, 10 Nov 2014 13:13:21 -0700 Subject: [PATCH 1/2] Keep the source and instead just "make clean" --- 5.4/Dockerfile | 21 +++++++++++---------- 5.4/apache/Dockerfile | 21 +++++++++++---------- 5.5/Dockerfile | 21 +++++++++++---------- 5.5/apache/Dockerfile | 21 +++++++++++---------- 5.6/Dockerfile | 21 +++++++++++---------- 5.6/apache/Dockerfile | 21 +++++++++++---------- 6 files changed, 66 insertions(+), 60 deletions(-) diff --git a/5.4/Dockerfile b/5.4/Dockerfile index 65c3b6aa..285ac913 100644 --- a/5.4/Dockerfile +++ b/5.4/Dockerfile @@ -3,6 +3,12 @@ FROM debian:jessie # persistent / runtime deps RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* +# phpize deps +RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* + +ENV PHP_INI_DIR /usr/local/etc/php +RUN mkdir -p $PHP_INI_DIR/conf.d + #### #### @@ -16,12 +22,9 @@ RUN buildDeps=" \ bzip2 \ file \ libcurl4-openssl-dev \ - libpng12-dev \ libreadline6-dev \ libssl-dev \ libxml2-dev \ - m4 \ - pkg-config \ "; \ set -x \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ @@ -32,22 +35,20 @@ RUN buildDeps=" \ && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ && rm php.tar.bz2* \ && cd /usr/src/php \ - && ./configure --disable-cgi \ + && ./configure \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ - --enable-soap \ + --disable-cgi \ --with-curl \ - --with-gd \ - --with-mysql \ - --with-mysqli \ --with-openssl \ - --with-pdo-mysql \ --with-readline \ --with-zlib \ && make -j"$(nproc)" \ && make install \ && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ && apt-get purge -y --auto-remove $buildDeps \ - && rm -r /usr/src/php + && make clean #### CMD ["php", "-a"] diff --git a/5.4/apache/Dockerfile b/5.4/apache/Dockerfile index 44c22990..12152ecc 100644 --- a/5.4/apache/Dockerfile +++ b/5.4/apache/Dockerfile @@ -3,6 +3,12 @@ FROM debian:jessie # persistent / runtime deps RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* +# phpize deps +RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* + +ENV PHP_INI_DIR /usr/local/etc/php +RUN mkdir -p $PHP_INI_DIR/conf.d + #### RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/* @@ -29,12 +35,9 @@ RUN buildDeps=" \ bzip2 \ file \ libcurl4-openssl-dev \ - libpng12-dev \ libreadline6-dev \ libssl-dev \ libxml2-dev \ - m4 \ - pkg-config \ "; \ set -x \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ @@ -45,22 +48,20 @@ RUN buildDeps=" \ && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ && rm php.tar.bz2* \ && cd /usr/src/php \ - && ./configure --disable-cgi \ + && ./configure \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ - --enable-soap \ + --disable-cgi \ --with-curl \ - --with-gd \ - --with-mysql \ - --with-mysqli \ --with-openssl \ - --with-pdo-mysql \ --with-readline \ --with-zlib \ && make -j"$(nproc)" \ && make install \ && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ && apt-get purge -y --auto-remove $buildDeps \ - && rm -r /usr/src/php + && make clean #### WORKDIR /var/www/html diff --git a/5.5/Dockerfile b/5.5/Dockerfile index eb54eb27..c0e18d84 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -3,6 +3,12 @@ FROM debian:jessie # persistent / runtime deps RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* +# phpize deps +RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* + +ENV PHP_INI_DIR /usr/local/etc/php +RUN mkdir -p $PHP_INI_DIR/conf.d + #### #### @@ -16,12 +22,9 @@ RUN buildDeps=" \ bzip2 \ file \ libcurl4-openssl-dev \ - libpng12-dev \ libreadline6-dev \ libssl-dev \ libxml2-dev \ - m4 \ - pkg-config \ "; \ set -x \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ @@ -32,22 +35,20 @@ RUN buildDeps=" \ && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ && rm php.tar.bz2* \ && cd /usr/src/php \ - && ./configure --disable-cgi \ + && ./configure \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ - --enable-soap \ + --disable-cgi \ --with-curl \ - --with-gd \ - --with-mysql \ - --with-mysqli \ --with-openssl \ - --with-pdo-mysql \ --with-readline \ --with-zlib \ && make -j"$(nproc)" \ && make install \ && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ && apt-get purge -y --auto-remove $buildDeps \ - && rm -r /usr/src/php + && make clean #### CMD ["php", "-a"] diff --git a/5.5/apache/Dockerfile b/5.5/apache/Dockerfile index 32d70fc1..52a10bdf 100644 --- a/5.5/apache/Dockerfile +++ b/5.5/apache/Dockerfile @@ -3,6 +3,12 @@ FROM debian:jessie # persistent / runtime deps RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* +# phpize deps +RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* + +ENV PHP_INI_DIR /usr/local/etc/php +RUN mkdir -p $PHP_INI_DIR/conf.d + #### RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/* @@ -29,12 +35,9 @@ RUN buildDeps=" \ bzip2 \ file \ libcurl4-openssl-dev \ - libpng12-dev \ libreadline6-dev \ libssl-dev \ libxml2-dev \ - m4 \ - pkg-config \ "; \ set -x \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ @@ -45,22 +48,20 @@ RUN buildDeps=" \ && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ && rm php.tar.bz2* \ && cd /usr/src/php \ - && ./configure --disable-cgi \ + && ./configure \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ - --enable-soap \ + --disable-cgi \ --with-curl \ - --with-gd \ - --with-mysql \ - --with-mysqli \ --with-openssl \ - --with-pdo-mysql \ --with-readline \ --with-zlib \ && make -j"$(nproc)" \ && make install \ && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ && apt-get purge -y --auto-remove $buildDeps \ - && rm -r /usr/src/php + && make clean #### WORKDIR /var/www/html diff --git a/5.6/Dockerfile b/5.6/Dockerfile index afbd82c9..c0497301 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -3,6 +3,12 @@ FROM debian:jessie # persistent / runtime deps RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* +# phpize deps +RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* + +ENV PHP_INI_DIR /usr/local/etc/php +RUN mkdir -p $PHP_INI_DIR/conf.d + #### #### @@ -16,12 +22,9 @@ RUN buildDeps=" \ bzip2 \ file \ libcurl4-openssl-dev \ - libpng12-dev \ libreadline6-dev \ libssl-dev \ libxml2-dev \ - m4 \ - pkg-config \ "; \ set -x \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ @@ -32,22 +35,20 @@ RUN buildDeps=" \ && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ && rm php.tar.bz2* \ && cd /usr/src/php \ - && ./configure --disable-cgi \ + && ./configure \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ - --enable-soap \ + --disable-cgi \ --with-curl \ - --with-gd \ - --with-mysql \ - --with-mysqli \ --with-openssl \ - --with-pdo-mysql \ --with-readline \ --with-zlib \ && make -j"$(nproc)" \ && make install \ && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ && apt-get purge -y --auto-remove $buildDeps \ - && rm -r /usr/src/php + && make clean #### CMD ["php", "-a"] diff --git a/5.6/apache/Dockerfile b/5.6/apache/Dockerfile index 527bcf18..47d47a8c 100644 --- a/5.6/apache/Dockerfile +++ b/5.6/apache/Dockerfile @@ -3,6 +3,12 @@ FROM debian:jessie # persistent / runtime deps RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* +# phpize deps +RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* + +ENV PHP_INI_DIR /usr/local/etc/php +RUN mkdir -p $PHP_INI_DIR/conf.d + #### RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && rm -rf /var/lib/apt/lists/* @@ -29,12 +35,9 @@ RUN buildDeps=" \ bzip2 \ file \ libcurl4-openssl-dev \ - libpng12-dev \ libreadline6-dev \ libssl-dev \ libxml2-dev \ - m4 \ - pkg-config \ "; \ set -x \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ @@ -45,22 +48,20 @@ RUN buildDeps=" \ && tar -xf php.tar.bz2 -C /usr/src/php --strip-components=1 \ && rm php.tar.bz2* \ && cd /usr/src/php \ - && ./configure --disable-cgi \ + && ./configure \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ - --enable-soap \ + --disable-cgi \ --with-curl \ - --with-gd \ - --with-mysql \ - --with-mysqli \ --with-openssl \ - --with-pdo-mysql \ --with-readline \ --with-zlib \ && make -j"$(nproc)" \ && make install \ && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ && apt-get purge -y --auto-remove $buildDeps \ - && rm -r /usr/src/php + && make clean #### WORKDIR /var/www/html From 2c5880107a84631b60439625b6b19c412de196ba Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Tue, 11 Nov 2014 13:17:28 -0700 Subject: [PATCH 2/2] Add new `docker-php-ext-*` scripts for magic For example, the following makes WordPress work: ```Dockerfile RUN apt-get update && apt-get install -y libpng12-dev && rm -rf /var/lib/apt/lists/* \ && docker-php-ext-install gd \ && apt-get purge --auto-remove -y libpng12-dev RUN docker-php-ext-install mysqli ``` --- 5.4/Dockerfile | 7 ++-- 5.4/apache/Dockerfile | 7 ++-- 5.4/apache/docker-php-ext-configure | 19 ++++++++++ 5.4/apache/docker-php-ext-install | 55 +++++++++++++++++++++++++++++ 5.4/docker-php-ext-configure | 19 ++++++++++ 5.4/docker-php-ext-install | 55 +++++++++++++++++++++++++++++ 5.5/Dockerfile | 7 ++-- 5.5/apache/Dockerfile | 7 ++-- 5.5/apache/docker-php-ext-configure | 19 ++++++++++ 5.5/apache/docker-php-ext-install | 55 +++++++++++++++++++++++++++++ 5.5/docker-php-ext-configure | 19 ++++++++++ 5.5/docker-php-ext-install | 55 +++++++++++++++++++++++++++++ 5.6/Dockerfile | 7 ++-- 5.6/apache/Dockerfile | 7 ++-- 5.6/apache/docker-php-ext-configure | 19 ++++++++++ 5.6/apache/docker-php-ext-install | 55 +++++++++++++++++++++++++++++ 5.6/docker-php-ext-configure | 19 ++++++++++ 5.6/docker-php-ext-install | 55 +++++++++++++++++++++++++++++ docker-php-ext-configure | 19 ++++++++++ docker-php-ext-install | 55 +++++++++++++++++++++++++++++ update.sh | 2 ++ 21 files changed, 550 insertions(+), 12 deletions(-) create mode 100755 5.4/apache/docker-php-ext-configure create mode 100755 5.4/apache/docker-php-ext-install create mode 100755 5.4/docker-php-ext-configure create mode 100755 5.4/docker-php-ext-install create mode 100755 5.5/apache/docker-php-ext-configure create mode 100755 5.5/apache/docker-php-ext-install create mode 100755 5.5/docker-php-ext-configure create mode 100755 5.5/docker-php-ext-install create mode 100755 5.6/apache/docker-php-ext-configure create mode 100755 5.6/apache/docker-php-ext-install create mode 100755 5.6/docker-php-ext-configure create mode 100755 5.6/docker-php-ext-install create mode 100755 docker-php-ext-configure create mode 100755 docker-php-ext-install diff --git a/5.4/Dockerfile b/5.4/Dockerfile index 285ac913..1625e3f3 100644 --- a/5.4/Dockerfile +++ b/5.4/Dockerfile @@ -4,7 +4,7 @@ FROM debian:jessie RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* # phpize deps -RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y autoconf gcc pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* ENV PHP_INI_DIR /usr/local/etc/php RUN mkdir -p $PHP_INI_DIR/conf.d @@ -16,9 +16,9 @@ RUN gpg --keyserver pgp.mit.edu --recv-keys F38252826ACD957EF380D39F2F7956BC5DA0 ENV PHP_VERSION 5.4.34 +# --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) RUN buildDeps=" \ $PHP_EXTRA_BUILD_DEPS \ - build-essential \ bzip2 \ file \ libcurl4-openssl-dev \ @@ -40,6 +40,7 @@ RUN buildDeps=" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ --disable-cgi \ + --enable-mysqlnd \ --with-curl \ --with-openssl \ --with-readline \ @@ -50,6 +51,8 @@ RUN buildDeps=" \ && apt-get purge -y --auto-remove $buildDeps \ && make clean +COPY docker-php-ext-* /usr/local/bin/ + #### CMD ["php", "-a"] #### diff --git a/5.4/apache/Dockerfile b/5.4/apache/Dockerfile index 12152ecc..3b88c227 100644 --- a/5.4/apache/Dockerfile +++ b/5.4/apache/Dockerfile @@ -4,7 +4,7 @@ FROM debian:jessie RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* # phpize deps -RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y autoconf gcc pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* ENV PHP_INI_DIR /usr/local/etc/php RUN mkdir -p $PHP_INI_DIR/conf.d @@ -29,9 +29,9 @@ RUN gpg --keyserver pgp.mit.edu --recv-keys F38252826ACD957EF380D39F2F7956BC5DA0 ENV PHP_VERSION 5.4.34 +# --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) RUN buildDeps=" \ $PHP_EXTRA_BUILD_DEPS \ - build-essential \ bzip2 \ file \ libcurl4-openssl-dev \ @@ -53,6 +53,7 @@ RUN buildDeps=" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ --disable-cgi \ + --enable-mysqlnd \ --with-curl \ --with-openssl \ --with-readline \ @@ -63,6 +64,8 @@ RUN buildDeps=" \ && apt-get purge -y --auto-remove $buildDeps \ && make clean +COPY docker-php-ext-* /usr/local/bin/ + #### WORKDIR /var/www/html diff --git a/5.4/apache/docker-php-ext-configure b/5.4/apache/docker-php-ext-configure new file mode 100755 index 00000000..3d21b5bb --- /dev/null +++ b/5.4/apache/docker-php-ext-configure @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +ext="$1" +extDir="/usr/src/php/ext/$ext" +if [ -z "$ext" -o ! -d "$extDir" ]; then + echo >&2 "usage: $0 ext-name [configure flags]" + echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" + echo >&2 + echo >&2 'Possible values for ext-name:' + echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) + exit 1 +fi +shift + +set -x +cd "$extDir" +phpize +./configure "$@" diff --git a/5.4/apache/docker-php-ext-install b/5.4/apache/docker-php-ext-install new file mode 100755 index 00000000..abca7fff --- /dev/null +++ b/5.4/apache/docker-php-ext-install @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) +} + +exts=() +while [ $# -gt 0 ]; do + ext="$1" + shift + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $(pwd -P)/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts+=( "$ext" ) +done + +if [ "${#exts[@]}" -eq 0 ]; then + usage >&2 + exit 1 +fi + +for ext in "${exts[@]}"; do + ( + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make + make install + ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" + for module in modules/*.so; do + if [ -f "$module" ]; then + line="extension=$(basename "$module")" + if ! grep -q "$line" "$ini"; then + echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" + fi + fi + done + make clean + ) +done diff --git a/5.4/docker-php-ext-configure b/5.4/docker-php-ext-configure new file mode 100755 index 00000000..3d21b5bb --- /dev/null +++ b/5.4/docker-php-ext-configure @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +ext="$1" +extDir="/usr/src/php/ext/$ext" +if [ -z "$ext" -o ! -d "$extDir" ]; then + echo >&2 "usage: $0 ext-name [configure flags]" + echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" + echo >&2 + echo >&2 'Possible values for ext-name:' + echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) + exit 1 +fi +shift + +set -x +cd "$extDir" +phpize +./configure "$@" diff --git a/5.4/docker-php-ext-install b/5.4/docker-php-ext-install new file mode 100755 index 00000000..abca7fff --- /dev/null +++ b/5.4/docker-php-ext-install @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) +} + +exts=() +while [ $# -gt 0 ]; do + ext="$1" + shift + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $(pwd -P)/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts+=( "$ext" ) +done + +if [ "${#exts[@]}" -eq 0 ]; then + usage >&2 + exit 1 +fi + +for ext in "${exts[@]}"; do + ( + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make + make install + ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" + for module in modules/*.so; do + if [ -f "$module" ]; then + line="extension=$(basename "$module")" + if ! grep -q "$line" "$ini"; then + echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" + fi + fi + done + make clean + ) +done diff --git a/5.5/Dockerfile b/5.5/Dockerfile index c0e18d84..43888454 100644 --- a/5.5/Dockerfile +++ b/5.5/Dockerfile @@ -4,7 +4,7 @@ FROM debian:jessie RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* # phpize deps -RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y autoconf gcc pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* ENV PHP_INI_DIR /usr/local/etc/php RUN mkdir -p $PHP_INI_DIR/conf.d @@ -16,9 +16,9 @@ RUN gpg --keyserver pgp.mit.edu --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D9 ENV PHP_VERSION 5.5.18 +# --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) RUN buildDeps=" \ $PHP_EXTRA_BUILD_DEPS \ - build-essential \ bzip2 \ file \ libcurl4-openssl-dev \ @@ -40,6 +40,7 @@ RUN buildDeps=" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ --disable-cgi \ + --enable-mysqlnd \ --with-curl \ --with-openssl \ --with-readline \ @@ -50,6 +51,8 @@ RUN buildDeps=" \ && apt-get purge -y --auto-remove $buildDeps \ && make clean +COPY docker-php-ext-* /usr/local/bin/ + #### CMD ["php", "-a"] #### diff --git a/5.5/apache/Dockerfile b/5.5/apache/Dockerfile index 52a10bdf..1aa4e8f4 100644 --- a/5.5/apache/Dockerfile +++ b/5.5/apache/Dockerfile @@ -4,7 +4,7 @@ FROM debian:jessie RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* # phpize deps -RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y autoconf gcc pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* ENV PHP_INI_DIR /usr/local/etc/php RUN mkdir -p $PHP_INI_DIR/conf.d @@ -29,9 +29,9 @@ RUN gpg --keyserver pgp.mit.edu --recv-keys 0BD78B5F97500D450838F95DFE857D9A90D9 ENV PHP_VERSION 5.5.18 +# --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) RUN buildDeps=" \ $PHP_EXTRA_BUILD_DEPS \ - build-essential \ bzip2 \ file \ libcurl4-openssl-dev \ @@ -53,6 +53,7 @@ RUN buildDeps=" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ --disable-cgi \ + --enable-mysqlnd \ --with-curl \ --with-openssl \ --with-readline \ @@ -63,6 +64,8 @@ RUN buildDeps=" \ && apt-get purge -y --auto-remove $buildDeps \ && make clean +COPY docker-php-ext-* /usr/local/bin/ + #### WORKDIR /var/www/html diff --git a/5.5/apache/docker-php-ext-configure b/5.5/apache/docker-php-ext-configure new file mode 100755 index 00000000..3d21b5bb --- /dev/null +++ b/5.5/apache/docker-php-ext-configure @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +ext="$1" +extDir="/usr/src/php/ext/$ext" +if [ -z "$ext" -o ! -d "$extDir" ]; then + echo >&2 "usage: $0 ext-name [configure flags]" + echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" + echo >&2 + echo >&2 'Possible values for ext-name:' + echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) + exit 1 +fi +shift + +set -x +cd "$extDir" +phpize +./configure "$@" diff --git a/5.5/apache/docker-php-ext-install b/5.5/apache/docker-php-ext-install new file mode 100755 index 00000000..abca7fff --- /dev/null +++ b/5.5/apache/docker-php-ext-install @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) +} + +exts=() +while [ $# -gt 0 ]; do + ext="$1" + shift + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $(pwd -P)/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts+=( "$ext" ) +done + +if [ "${#exts[@]}" -eq 0 ]; then + usage >&2 + exit 1 +fi + +for ext in "${exts[@]}"; do + ( + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make + make install + ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" + for module in modules/*.so; do + if [ -f "$module" ]; then + line="extension=$(basename "$module")" + if ! grep -q "$line" "$ini"; then + echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" + fi + fi + done + make clean + ) +done diff --git a/5.5/docker-php-ext-configure b/5.5/docker-php-ext-configure new file mode 100755 index 00000000..3d21b5bb --- /dev/null +++ b/5.5/docker-php-ext-configure @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +ext="$1" +extDir="/usr/src/php/ext/$ext" +if [ -z "$ext" -o ! -d "$extDir" ]; then + echo >&2 "usage: $0 ext-name [configure flags]" + echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" + echo >&2 + echo >&2 'Possible values for ext-name:' + echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) + exit 1 +fi +shift + +set -x +cd "$extDir" +phpize +./configure "$@" diff --git a/5.5/docker-php-ext-install b/5.5/docker-php-ext-install new file mode 100755 index 00000000..abca7fff --- /dev/null +++ b/5.5/docker-php-ext-install @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) +} + +exts=() +while [ $# -gt 0 ]; do + ext="$1" + shift + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $(pwd -P)/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts+=( "$ext" ) +done + +if [ "${#exts[@]}" -eq 0 ]; then + usage >&2 + exit 1 +fi + +for ext in "${exts[@]}"; do + ( + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make + make install + ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" + for module in modules/*.so; do + if [ -f "$module" ]; then + line="extension=$(basename "$module")" + if ! grep -q "$line" "$ini"; then + echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" + fi + fi + done + make clean + ) +done diff --git a/5.6/Dockerfile b/5.6/Dockerfile index c0497301..7a660e26 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -4,7 +4,7 @@ FROM debian:jessie RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* # phpize deps -RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y autoconf gcc pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* ENV PHP_INI_DIR /usr/local/etc/php RUN mkdir -p $PHP_INI_DIR/conf.d @@ -16,9 +16,9 @@ RUN gpg --keyserver pgp.mit.edu --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CF ENV PHP_VERSION 5.6.2 +# --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) RUN buildDeps=" \ $PHP_EXTRA_BUILD_DEPS \ - build-essential \ bzip2 \ file \ libcurl4-openssl-dev \ @@ -40,6 +40,7 @@ RUN buildDeps=" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ --disable-cgi \ + --enable-mysqlnd \ --with-curl \ --with-openssl \ --with-readline \ @@ -50,6 +51,8 @@ RUN buildDeps=" \ && apt-get purge -y --auto-remove $buildDeps \ && make clean +COPY docker-php-ext-* /usr/local/bin/ + #### CMD ["php", "-a"] #### diff --git a/5.6/apache/Dockerfile b/5.6/apache/Dockerfile index 47d47a8c..8a21997e 100644 --- a/5.6/apache/Dockerfile +++ b/5.6/apache/Dockerfile @@ -4,7 +4,7 @@ FROM debian:jessie RUN apt-get update && apt-get install -y ca-certificates curl libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/* # phpize deps -RUN apt-get update && apt-get install -y autoconf pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y autoconf gcc pkg-config --no-install-recommends && rm -r /var/lib/apt/lists/* ENV PHP_INI_DIR /usr/local/etc/php RUN mkdir -p $PHP_INI_DIR/conf.d @@ -29,9 +29,9 @@ RUN gpg --keyserver pgp.mit.edu --recv-keys 6E4F6AB321FDC07F2C332E3AC2BF0BC433CF ENV PHP_VERSION 5.6.2 +# --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself) RUN buildDeps=" \ $PHP_EXTRA_BUILD_DEPS \ - build-essential \ bzip2 \ file \ libcurl4-openssl-dev \ @@ -53,6 +53,7 @@ RUN buildDeps=" \ --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ $PHP_EXTRA_CONFIGURE_ARGS \ --disable-cgi \ + --enable-mysqlnd \ --with-curl \ --with-openssl \ --with-readline \ @@ -63,6 +64,8 @@ RUN buildDeps=" \ && apt-get purge -y --auto-remove $buildDeps \ && make clean +COPY docker-php-ext-* /usr/local/bin/ + #### WORKDIR /var/www/html diff --git a/5.6/apache/docker-php-ext-configure b/5.6/apache/docker-php-ext-configure new file mode 100755 index 00000000..3d21b5bb --- /dev/null +++ b/5.6/apache/docker-php-ext-configure @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +ext="$1" +extDir="/usr/src/php/ext/$ext" +if [ -z "$ext" -o ! -d "$extDir" ]; then + echo >&2 "usage: $0 ext-name [configure flags]" + echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" + echo >&2 + echo >&2 'Possible values for ext-name:' + echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) + exit 1 +fi +shift + +set -x +cd "$extDir" +phpize +./configure "$@" diff --git a/5.6/apache/docker-php-ext-install b/5.6/apache/docker-php-ext-install new file mode 100755 index 00000000..abca7fff --- /dev/null +++ b/5.6/apache/docker-php-ext-install @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) +} + +exts=() +while [ $# -gt 0 ]; do + ext="$1" + shift + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $(pwd -P)/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts+=( "$ext" ) +done + +if [ "${#exts[@]}" -eq 0 ]; then + usage >&2 + exit 1 +fi + +for ext in "${exts[@]}"; do + ( + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make + make install + ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" + for module in modules/*.so; do + if [ -f "$module" ]; then + line="extension=$(basename "$module")" + if ! grep -q "$line" "$ini"; then + echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" + fi + fi + done + make clean + ) +done diff --git a/5.6/docker-php-ext-configure b/5.6/docker-php-ext-configure new file mode 100755 index 00000000..3d21b5bb --- /dev/null +++ b/5.6/docker-php-ext-configure @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +ext="$1" +extDir="/usr/src/php/ext/$ext" +if [ -z "$ext" -o ! -d "$extDir" ]; then + echo >&2 "usage: $0 ext-name [configure flags]" + echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" + echo >&2 + echo >&2 'Possible values for ext-name:' + echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) + exit 1 +fi +shift + +set -x +cd "$extDir" +phpize +./configure "$@" diff --git a/5.6/docker-php-ext-install b/5.6/docker-php-ext-install new file mode 100755 index 00000000..abca7fff --- /dev/null +++ b/5.6/docker-php-ext-install @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) +} + +exts=() +while [ $# -gt 0 ]; do + ext="$1" + shift + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $(pwd -P)/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts+=( "$ext" ) +done + +if [ "${#exts[@]}" -eq 0 ]; then + usage >&2 + exit 1 +fi + +for ext in "${exts[@]}"; do + ( + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make + make install + ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" + for module in modules/*.so; do + if [ -f "$module" ]; then + line="extension=$(basename "$module")" + if ! grep -q "$line" "$ini"; then + echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" + fi + fi + done + make clean + ) +done diff --git a/docker-php-ext-configure b/docker-php-ext-configure new file mode 100755 index 00000000..3d21b5bb --- /dev/null +++ b/docker-php-ext-configure @@ -0,0 +1,19 @@ +#!/bin/bash +set -e + +ext="$1" +extDir="/usr/src/php/ext/$ext" +if [ -z "$ext" -o ! -d "$extDir" ]; then + echo >&2 "usage: $0 ext-name [configure flags]" + echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" + echo >&2 + echo >&2 'Possible values for ext-name:' + echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) + exit 1 +fi +shift + +set -x +cd "$extDir" +phpize +./configure "$@" diff --git a/docker-php-ext-install b/docker-php-ext-install new file mode 100755 index 00000000..abca7fff --- /dev/null +++ b/docker-php-ext-install @@ -0,0 +1,55 @@ +#!/bin/bash +set -e + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort) +} + +exts=() +while [ $# -gt 0 ]; do + ext="$1" + shift + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $(pwd -P)/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts+=( "$ext" ) +done + +if [ "${#exts[@]}" -eq 0 ]; then + usage >&2 + exit 1 +fi + +for ext in "${exts[@]}"; do + ( + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make + make install + ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini" + for module in modules/*.so; do + if [ -f "$module" ]; then + line="extension=$(basename "$module")" + if ! grep -q "$line" "$ini"; then + echo "$line" >> "/usr/local/etc/php/conf.d/ext-$ext.ini" + fi + fi + done + make clean + ) +done diff --git a/update.sh b/update.sh index 5c7b2545..b5e29c78 100755 --- a/update.sh +++ b/update.sh @@ -49,6 +49,8 @@ for version in "${versions[@]}"; do s/^(RUN gpg .* --recv-keys) [0-9a-fA-F ]*$/\1 '"$gpgKey"'/ ' "$version/Dockerfile" + cp docker-php-ext-* "$version/" + cp docker-php-ext-* "$version/apache/" cp apache2.conf "$version/apache/" ) done