From ddc7084c8a78ea12f0cfdceff7d03c5a530b787e Mon Sep 17 00:00:00 2001 From: Tianon Gravi Date: Fri, 9 Jun 2017 13:54:54 -0700 Subject: [PATCH] Add 7.2.0alpha3 --- .travis.yml | 7 + 5.6/Dockerfile | 15 +- 5.6/alpine/Dockerfile | 2 +- 5.6/apache/Dockerfile | 15 +- 5.6/fpm/Dockerfile | 15 +- 5.6/fpm/alpine/Dockerfile | 2 +- 5.6/zts/Dockerfile | 15 +- 5.6/zts/alpine/Dockerfile | 2 +- 7.0/Dockerfile | 15 +- 7.0/alpine/Dockerfile | 2 +- 7.0/apache/Dockerfile | 15 +- 7.0/fpm/Dockerfile | 15 +- 7.0/fpm/alpine/Dockerfile | 2 +- 7.0/zts/Dockerfile | 15 +- 7.0/zts/alpine/Dockerfile | 2 +- 7.1/Dockerfile | 15 +- 7.1/alpine/Dockerfile | 2 +- 7.1/apache/Dockerfile | 15 +- 7.1/fpm/Dockerfile | 15 +- 7.1/fpm/alpine/Dockerfile | 2 +- 7.1/zts/Dockerfile | 15 +- 7.1/zts/alpine/Dockerfile | 2 +- 7.2-rc/Dockerfile | 160 +++++++++++++++ 7.2-rc/alpine/Dockerfile | 158 +++++++++++++++ 7.2-rc/alpine/docker-php-entrypoint | 9 + 7.2-rc/alpine/docker-php-ext-configure | 63 ++++++ 7.2-rc/alpine/docker-php-ext-enable | 104 ++++++++++ 7.2-rc/alpine/docker-php-ext-install | 119 +++++++++++ 7.2-rc/alpine/docker-php-source | 34 ++++ 7.2-rc/apache/Dockerfile | 223 +++++++++++++++++++++ 7.2-rc/apache/apache2-foreground | 40 ++++ 7.2-rc/apache/docker-php-entrypoint | 9 + 7.2-rc/apache/docker-php-ext-configure | 63 ++++++ 7.2-rc/apache/docker-php-ext-enable | 104 ++++++++++ 7.2-rc/apache/docker-php-ext-install | 119 +++++++++++ 7.2-rc/apache/docker-php-source | 34 ++++ 7.2-rc/docker-php-entrypoint | 9 + 7.2-rc/docker-php-ext-configure | 63 ++++++ 7.2-rc/docker-php-ext-enable | 104 ++++++++++ 7.2-rc/docker-php-ext-install | 119 +++++++++++ 7.2-rc/docker-php-source | 34 ++++ 7.2-rc/fpm/Dockerfile | 200 ++++++++++++++++++ 7.2-rc/fpm/alpine/Dockerfile | 198 ++++++++++++++++++ 7.2-rc/fpm/alpine/docker-php-entrypoint | 9 + 7.2-rc/fpm/alpine/docker-php-ext-configure | 63 ++++++ 7.2-rc/fpm/alpine/docker-php-ext-enable | 104 ++++++++++ 7.2-rc/fpm/alpine/docker-php-ext-install | 119 +++++++++++ 7.2-rc/fpm/alpine/docker-php-source | 34 ++++ 7.2-rc/fpm/docker-php-entrypoint | 9 + 7.2-rc/fpm/docker-php-ext-configure | 63 ++++++ 7.2-rc/fpm/docker-php-ext-enable | 104 ++++++++++ 7.2-rc/fpm/docker-php-ext-install | 119 +++++++++++ 7.2-rc/fpm/docker-php-source | 34 ++++ 7.2-rc/zts/Dockerfile | 161 +++++++++++++++ 7.2-rc/zts/alpine/Dockerfile | 159 +++++++++++++++ 7.2-rc/zts/alpine/docker-php-entrypoint | 9 + 7.2-rc/zts/alpine/docker-php-ext-configure | 63 ++++++ 7.2-rc/zts/alpine/docker-php-ext-enable | 104 ++++++++++ 7.2-rc/zts/alpine/docker-php-ext-install | 119 +++++++++++ 7.2-rc/zts/alpine/docker-php-source | 34 ++++ 7.2-rc/zts/docker-php-entrypoint | 9 + 7.2-rc/zts/docker-php-ext-configure | 63 ++++++ 7.2-rc/zts/docker-php-ext-enable | 104 ++++++++++ 7.2-rc/zts/docker-php-ext-install | 119 +++++++++++ 7.2-rc/zts/docker-php-source | 34 ++++ Dockerfile-alpine.template | 2 +- Dockerfile-debian.template | 15 +- update.sh | 2 +- 68 files changed, 3789 insertions(+), 37 deletions(-) create mode 100644 7.2-rc/Dockerfile create mode 100644 7.2-rc/alpine/Dockerfile create mode 100755 7.2-rc/alpine/docker-php-entrypoint create mode 100755 7.2-rc/alpine/docker-php-ext-configure create mode 100755 7.2-rc/alpine/docker-php-ext-enable create mode 100755 7.2-rc/alpine/docker-php-ext-install create mode 100755 7.2-rc/alpine/docker-php-source create mode 100644 7.2-rc/apache/Dockerfile create mode 100755 7.2-rc/apache/apache2-foreground create mode 100755 7.2-rc/apache/docker-php-entrypoint create mode 100755 7.2-rc/apache/docker-php-ext-configure create mode 100755 7.2-rc/apache/docker-php-ext-enable create mode 100755 7.2-rc/apache/docker-php-ext-install create mode 100755 7.2-rc/apache/docker-php-source create mode 100755 7.2-rc/docker-php-entrypoint create mode 100755 7.2-rc/docker-php-ext-configure create mode 100755 7.2-rc/docker-php-ext-enable create mode 100755 7.2-rc/docker-php-ext-install create mode 100755 7.2-rc/docker-php-source create mode 100644 7.2-rc/fpm/Dockerfile create mode 100644 7.2-rc/fpm/alpine/Dockerfile create mode 100755 7.2-rc/fpm/alpine/docker-php-entrypoint create mode 100755 7.2-rc/fpm/alpine/docker-php-ext-configure create mode 100755 7.2-rc/fpm/alpine/docker-php-ext-enable create mode 100755 7.2-rc/fpm/alpine/docker-php-ext-install create mode 100755 7.2-rc/fpm/alpine/docker-php-source create mode 100755 7.2-rc/fpm/docker-php-entrypoint create mode 100755 7.2-rc/fpm/docker-php-ext-configure create mode 100755 7.2-rc/fpm/docker-php-ext-enable create mode 100755 7.2-rc/fpm/docker-php-ext-install create mode 100755 7.2-rc/fpm/docker-php-source create mode 100644 7.2-rc/zts/Dockerfile create mode 100644 7.2-rc/zts/alpine/Dockerfile create mode 100755 7.2-rc/zts/alpine/docker-php-entrypoint create mode 100755 7.2-rc/zts/alpine/docker-php-ext-configure create mode 100755 7.2-rc/zts/alpine/docker-php-ext-enable create mode 100755 7.2-rc/zts/alpine/docker-php-ext-install create mode 100755 7.2-rc/zts/alpine/docker-php-source create mode 100755 7.2-rc/zts/docker-php-entrypoint create mode 100755 7.2-rc/zts/docker-php-ext-configure create mode 100755 7.2-rc/zts/docker-php-ext-enable create mode 100755 7.2-rc/zts/docker-php-ext-install create mode 100755 7.2-rc/zts/docker-php-source diff --git a/.travis.yml b/.travis.yml index 0f0b2aa2..523a6f4f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,6 +2,13 @@ language: bash services: docker env: + - VERSION=7.2-rc VARIANT= + - VERSION=7.2-rc VARIANT=alpine + - VERSION=7.2-rc VARIANT=apache + - VERSION=7.2-rc VARIANT=fpm + - VERSION=7.2-rc VARIANT=fpm/alpine + - VERSION=7.2-rc VARIANT=zts + - VERSION=7.2-rc VARIANT=zts/alpine - VERSION=7.1 VARIANT= - VERSION=7.1 VARIANT=alpine - VERSION=7.1 VARIANT=apache diff --git a/5.6/Dockerfile b/5.6/Dockerfile index 15b6e1ea..e998d5d8 100644 --- a/5.6/Dockerfile +++ b/5.6/Dockerfile @@ -55,6 +55,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -78,10 +84,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -93,6 +99,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -103,6 +110,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/5.6/alpine/Dockerfile b/5.6/alpine/Dockerfile index 25be176f..df5768ae 100644 --- a/5.6/alpine/Dockerfile +++ b/5.6/alpine/Dockerfile @@ -81,7 +81,7 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ apk del .fetch-deps diff --git a/5.6/apache/Dockerfile b/5.6/apache/Dockerfile index c7cdc26a..6f73faa5 100644 --- a/5.6/apache/Dockerfile +++ b/5.6/apache/Dockerfile @@ -114,6 +114,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -137,10 +143,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -152,6 +158,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -162,6 +169,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/5.6/fpm/Dockerfile b/5.6/fpm/Dockerfile index b4674bae..22c13c75 100644 --- a/5.6/fpm/Dockerfile +++ b/5.6/fpm/Dockerfile @@ -56,6 +56,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -79,10 +85,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -94,6 +100,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -104,6 +111,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/5.6/fpm/alpine/Dockerfile b/5.6/fpm/alpine/Dockerfile index e8781bfe..22f5397a 100644 --- a/5.6/fpm/alpine/Dockerfile +++ b/5.6/fpm/alpine/Dockerfile @@ -82,7 +82,7 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ apk del .fetch-deps diff --git a/5.6/zts/Dockerfile b/5.6/zts/Dockerfile index 2a0f7049..4c1adb4b 100644 --- a/5.6/zts/Dockerfile +++ b/5.6/zts/Dockerfile @@ -56,6 +56,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -79,10 +85,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -94,6 +100,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -104,6 +111,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/5.6/zts/alpine/Dockerfile b/5.6/zts/alpine/Dockerfile index ec3e7713..c67d24a5 100644 --- a/5.6/zts/alpine/Dockerfile +++ b/5.6/zts/alpine/Dockerfile @@ -82,7 +82,7 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ apk del .fetch-deps diff --git a/7.0/Dockerfile b/7.0/Dockerfile index 1a6a9ecf..26371114 100644 --- a/7.0/Dockerfile +++ b/7.0/Dockerfile @@ -55,6 +55,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -78,10 +84,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -93,6 +99,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -103,6 +110,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/7.0/alpine/Dockerfile b/7.0/alpine/Dockerfile index 46305c6c..29da39d3 100644 --- a/7.0/alpine/Dockerfile +++ b/7.0/alpine/Dockerfile @@ -81,7 +81,7 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ apk del .fetch-deps diff --git a/7.0/apache/Dockerfile b/7.0/apache/Dockerfile index bfef836f..a1d5c273 100644 --- a/7.0/apache/Dockerfile +++ b/7.0/apache/Dockerfile @@ -114,6 +114,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -137,10 +143,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -152,6 +158,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -162,6 +169,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/7.0/fpm/Dockerfile b/7.0/fpm/Dockerfile index df18d446..79b850bb 100644 --- a/7.0/fpm/Dockerfile +++ b/7.0/fpm/Dockerfile @@ -56,6 +56,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -79,10 +85,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -94,6 +100,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -104,6 +111,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/7.0/fpm/alpine/Dockerfile b/7.0/fpm/alpine/Dockerfile index 85f40c74..07e21e70 100644 --- a/7.0/fpm/alpine/Dockerfile +++ b/7.0/fpm/alpine/Dockerfile @@ -82,7 +82,7 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ apk del .fetch-deps diff --git a/7.0/zts/Dockerfile b/7.0/zts/Dockerfile index 98127e2f..5a194506 100644 --- a/7.0/zts/Dockerfile +++ b/7.0/zts/Dockerfile @@ -56,6 +56,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -79,10 +85,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -94,6 +100,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -104,6 +111,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/7.0/zts/alpine/Dockerfile b/7.0/zts/alpine/Dockerfile index b01234d9..d9c7069f 100644 --- a/7.0/zts/alpine/Dockerfile +++ b/7.0/zts/alpine/Dockerfile @@ -82,7 +82,7 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ apk del .fetch-deps diff --git a/7.1/Dockerfile b/7.1/Dockerfile index 3dee25ce..ed74824e 100644 --- a/7.1/Dockerfile +++ b/7.1/Dockerfile @@ -55,6 +55,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -78,10 +84,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -93,6 +99,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -103,6 +110,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/7.1/alpine/Dockerfile b/7.1/alpine/Dockerfile index aad24a24..f067cb85 100644 --- a/7.1/alpine/Dockerfile +++ b/7.1/alpine/Dockerfile @@ -81,7 +81,7 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ apk del .fetch-deps diff --git a/7.1/apache/Dockerfile b/7.1/apache/Dockerfile index bb908fd3..8f021609 100644 --- a/7.1/apache/Dockerfile +++ b/7.1/apache/Dockerfile @@ -114,6 +114,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -137,10 +143,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -152,6 +158,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -162,6 +169,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/7.1/fpm/Dockerfile b/7.1/fpm/Dockerfile index 9f2f884c..5477cf96 100644 --- a/7.1/fpm/Dockerfile +++ b/7.1/fpm/Dockerfile @@ -56,6 +56,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -79,10 +85,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -94,6 +100,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -104,6 +111,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/7.1/fpm/alpine/Dockerfile b/7.1/fpm/alpine/Dockerfile index 1fd19a30..df37b05a 100644 --- a/7.1/fpm/alpine/Dockerfile +++ b/7.1/fpm/alpine/Dockerfile @@ -82,7 +82,7 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ apk del .fetch-deps diff --git a/7.1/zts/Dockerfile b/7.1/zts/Dockerfile index 90399670..06d3bc2e 100644 --- a/7.1/zts/Dockerfile +++ b/7.1/zts/Dockerfile @@ -56,6 +56,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -79,10 +85,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -94,6 +100,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -104,6 +111,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/7.1/zts/alpine/Dockerfile b/7.1/zts/alpine/Dockerfile index 619f7f0a..c05563de 100644 --- a/7.1/zts/alpine/Dockerfile +++ b/7.1/zts/alpine/Dockerfile @@ -82,7 +82,7 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ apk del .fetch-deps diff --git a/7.2-rc/Dockerfile b/7.2-rc/Dockerfile new file mode 100644 index 00000000..796a28f2 --- /dev/null +++ b/7.2-rc/Dockerfile @@ -0,0 +1,160 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:stretch-slim + +# persistent / runtime deps +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + libpcre3-dev \ + make \ + pkg-config \ + re2c +RUN apt-get update && apt-get install -y \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + libedit2 \ + libsqlite3-0 \ + libxml2 \ + xz-utils \ + --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 + +#### +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F + +ENV PHP_VERSION 7.2.0alpha3 +ENV PHP_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz" PHP_ASC_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz.asc" +ENV PHP_SHA256="68abd6fc51cc5cfc7a7b1c2153644c7052f3ed841c21519095dda24eee67f63b" PHP_MD5="" + +RUN set -xe; \ + \ + fetchDeps=' \ + wget \ + '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ + apt-get update; \ + apt-get install -y --no-install-recommends $fetchDeps; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + wget -O php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + wget -O php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps + +COPY docker-php-source /usr/local/bin/ + +RUN set -xe \ + && buildDeps=" \ + $PHP_EXTRA_BUILD_DEPS \ + libcurl4-openssl-dev \ + libedit-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + " \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + && docker-php-source extract \ + && cd /usr/src/php \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ + && ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ + --disable-cgi \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# bundled pcre is too old for s390x (which isn't exactly a good sign) +# /usr/src/php/ext/pcre/pcrelib/pcre_jit_compile.c:65:2: error: #error Unsupported architecture + --with-pcre-regex=/usr \ + --with-libdir="lib/$debMultiarch" \ + \ + $PHP_EXTRA_CONFIGURE_ARGS \ + && make -j "$(nproc)" \ + && make install \ + && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ + && make clean \ + && cd / \ + && docker-php-source delete \ + \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ + \ +# https://github.com/docker-library/php/issues/443 + && pecl update-channels \ + && rm -rf /tmp/pear ~/.pearrc + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +ENTRYPOINT ["docker-php-entrypoint"] +#### +CMD ["php", "-a"] +#### diff --git a/7.2-rc/alpine/Dockerfile b/7.2-rc/alpine/Dockerfile new file mode 100644 index 00000000..7475712c --- /dev/null +++ b/7.2-rc/alpine/Dockerfile @@ -0,0 +1,158 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.6 + +# persistent / runtime deps +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pcre-dev \ + pkgconf \ + re2c +RUN apk add --no-cache --virtual .persistent-deps \ + ca-certificates \ + curl \ + tar \ + xz + +# ensure www-data user exists +RUN set -x \ + && addgroup -g 82 -S www-data \ + && adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2 +# http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2 +# http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2 + +ENV PHP_INI_DIR /usr/local/etc/php +RUN mkdir -p $PHP_INI_DIR/conf.d + +#### +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F + +ENV PHP_VERSION 7.2.0alpha3 +ENV PHP_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz" PHP_ASC_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz.asc" +ENV PHP_SHA256="68abd6fc51cc5cfc7a7b1c2153644c7052f3ed841c21519095dda24eee67f63b" PHP_MD5="" + +RUN set -xe; \ + \ + apk add --no-cache --virtual .fetch-deps \ + gnupg \ + openssl \ + ; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + wget -O php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + wget -O php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apk del .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -xe \ + && apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + coreutils \ + curl-dev \ + libedit-dev \ + libxml2-dev \ + openssl-dev \ + sqlite-dev \ + \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + && docker-php-source extract \ + && cd /usr/src/php \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ + --disable-cgi \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# bundled pcre is too old for s390x (which isn't exactly a good sign) +# /usr/src/php/ext/pcre/pcrelib/pcre_jit_compile.c:65:2: error: #error Unsupported architecture + --with-pcre-regex=/usr \ + \ + $PHP_EXTRA_CONFIGURE_ARGS \ + && make -j "$(nproc)" \ + && make install \ + && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \ + && make clean \ + && cd / \ + && docker-php-source delete \ + \ + && runDeps="$( \ + scanelf --needed --nobanner --recursive /usr/local \ + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ + | sort -u \ + | xargs -r apk info --installed \ + | sort -u \ + )" \ + && apk add --no-cache --virtual .php-rundeps $runDeps \ + \ + && apk del .build-deps \ + \ +# https://github.com/docker-library/php/issues/443 + && pecl update-channels \ + && rm -rf /tmp/pear ~/.pearrc + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +ENTRYPOINT ["docker-php-entrypoint"] +#### +CMD ["php", "-a"] +#### diff --git a/7.2-rc/alpine/docker-php-entrypoint b/7.2-rc/alpine/docker-php-entrypoint new file mode 100755 index 00000000..88a016c1 --- /dev/null +++ b/7.2-rc/alpine/docker-php-entrypoint @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- php "$@" +fi + +exec "$@" diff --git a/7.2-rc/alpine/docker-php-ext-configure b/7.2-rc/alpine/docker-php-ext-configure new file mode 100755 index 00000000..375afd40 --- /dev/null +++ b/7.2-rc/alpine/docker-php-ext-configure @@ -0,0 +1,63 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +ext="$1" +if [ -z "$ext" ] || [ ! -d "$ext" ]; 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:' + find /usr/src/php/ext \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + exit 1 +fi +shift + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS + fi +fi + +if command -v dpkg-architecture > /dev/null; then + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" + set -- --build="$gnuArch" "$@" +fi + +set -x +cd "$ext" +phpize +./configure "$@" diff --git a/7.2-rc/alpine/docker-php-ext-enable b/7.2-rc/alpine/docker-php-ext-enable new file mode 100755 index 00000000..0acb79df --- /dev/null +++ b/7.2-rc/alpine/docker-php-ext-enable @@ -0,0 +1,104 @@ +#!/bin/sh +set -e + +cd "$(php -r 'echo ini_get("extension_dir");')" + +usage() { + echo "usage: $0 [options] module-name [module-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 --ini-name 0-apc.ini apcu apc" + echo + echo 'Possible values for module-name:' + echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) +} + +opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +modules= +for module; do + if [ -z "$module" ]; then + continue + fi + if [ -f "$module.so" ] && ! [ -f "$module" ]; then + # allow ".so" to be optional + module="$module.so" + fi + if ! [ -f "$module" ]; then + echo >&2 "error: $(readlink -f "$module") does not exist" + echo >&2 + usage >&2 + exit 1 + fi + modules="$modules $module" +done + +if [ -z "$modules" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils + apkDel='.docker-php-ext-enable-deps' + fi +fi + +for module in $modules; do + if nm -g "$module" | grep -q ' zend_extension_entry$'; then + # https://wiki.php.net/internals/extensions#loading_zend_extensions + line="zend_extension=$(readlink -f "$module")" + else + line="extension=$module" + fi + + ext="$(basename "$module")" + ext="${ext%.*}" + if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then + # this isn't perfect, but it's better than nothing + # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') + echo >&2 + echo >&2 "warning: $ext ($module) is already loaded!" + echo >&2 + continue + fi + + ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" + if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi diff --git a/7.2-rc/alpine/docker-php-ext-install b/7.2-rc/alpine/docker-php-ext-install new file mode 100755 index 00000000..c0660230 --- /dev/null +++ b/7.2-rc/alpine/docker-php-ext-install @@ -0,0 +1,119 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs +} + +opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make -j"$j" + make -j"$j" install + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' ';' \ + | xargs -r docker-php-ext-enable + make -j"$j" clean + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.2-rc/alpine/docker-php-source b/7.2-rc/alpine/docker-php-source new file mode 100755 index 00000000..9033d243 --- /dev/null +++ b/7.2-rc/alpine/docker-php-source @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +dir=/usr/src/php + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Manage php source tarball lifecycle." + echo + echo "Commands:" + echo " extract extract php source tarball into directory $dir if not already done." + echo " delete delete extracted php source located into $dir if not already done." + echo +} + +case "$1" in + extract) + mkdir -p "$dir" + if [ ! -f "$dir/.docker-extracted" ]; then + tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 + touch "$dir/.docker-extracted" + fi + ;; + + delete) + rm -rf "$dir" + ;; + + *) + usage + exit 1 + ;; +esac diff --git a/7.2-rc/apache/Dockerfile b/7.2-rc/apache/Dockerfile new file mode 100644 index 00000000..de2810ba --- /dev/null +++ b/7.2-rc/apache/Dockerfile @@ -0,0 +1,223 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:stretch-slim + +# persistent / runtime deps +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + libpcre3-dev \ + make \ + pkg-config \ + re2c +RUN apt-get update && apt-get install -y \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + libedit2 \ + libsqlite3-0 \ + libxml2 \ + xz-utils \ + --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 --no-install-recommends \ + apache2 \ + && rm -rf /var/lib/apt/lists/* + +ENV APACHE_CONFDIR /etc/apache2 +ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars + +RUN set -ex \ + \ +# generically convert lines like +# export APACHE_RUN_USER=www-data +# into +# : ${APACHE_RUN_USER:=www-data} +# export APACHE_RUN_USER +# so that they can be overridden at runtime ("-e APACHE_RUN_USER=...") + && sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \ + \ +# setup directories and permissions + && . "$APACHE_ENVVARS" \ + && for dir in \ + "$APACHE_LOCK_DIR" \ + "$APACHE_RUN_DIR" \ + "$APACHE_LOG_DIR" \ + /var/www/html \ + ; do \ + rm -rvf "$dir" \ + && mkdir -p "$dir" \ + && chown -R "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ + done + +# Apache + PHP requires preforking Apache for best results +RUN a2dismod mpm_event && a2enmod mpm_prefork + +# logs should go to stdout / stderr +RUN set -ex \ + && . "$APACHE_ENVVARS" \ + && ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log" \ + && ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log" \ + && ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log" + +# PHP files should be handled by PHP, and should be preferred over any other file type +RUN { \ + echo ''; \ + echo '\tSetHandler application/x-httpd-php'; \ + echo ''; \ + echo; \ + echo 'DirectoryIndex disabled'; \ + echo 'DirectoryIndex index.php index.html'; \ + echo; \ + echo ''; \ + echo '\tOptions -Indexes'; \ + echo '\tAllowOverride All'; \ + echo ''; \ + } | tee "$APACHE_CONFDIR/conf-available/docker-php.conf" \ + && a2enconf docker-php + +ENV PHP_EXTRA_BUILD_DEPS apache2-dev +ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F + +ENV PHP_VERSION 7.2.0alpha3 +ENV PHP_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz" PHP_ASC_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz.asc" +ENV PHP_SHA256="68abd6fc51cc5cfc7a7b1c2153644c7052f3ed841c21519095dda24eee67f63b" PHP_MD5="" + +RUN set -xe; \ + \ + fetchDeps=' \ + wget \ + '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ + apt-get update; \ + apt-get install -y --no-install-recommends $fetchDeps; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + wget -O php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + wget -O php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps + +COPY docker-php-source /usr/local/bin/ + +RUN set -xe \ + && buildDeps=" \ + $PHP_EXTRA_BUILD_DEPS \ + libcurl4-openssl-dev \ + libedit-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + " \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + && docker-php-source extract \ + && cd /usr/src/php \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ + && ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ + --disable-cgi \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# bundled pcre is too old for s390x (which isn't exactly a good sign) +# /usr/src/php/ext/pcre/pcrelib/pcre_jit_compile.c:65:2: error: #error Unsupported architecture + --with-pcre-regex=/usr \ + --with-libdir="lib/$debMultiarch" \ + \ + $PHP_EXTRA_CONFIGURE_ARGS \ + && make -j "$(nproc)" \ + && make install \ + && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ + && make clean \ + && cd / \ + && docker-php-source delete \ + \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ + \ +# https://github.com/docker-library/php/issues/443 + && pecl update-channels \ + && rm -rf /tmp/pear ~/.pearrc + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +ENTRYPOINT ["docker-php-entrypoint"] +#### +COPY apache2-foreground /usr/local/bin/ +WORKDIR /var/www/html + +EXPOSE 80 +CMD ["apache2-foreground"] +#### diff --git a/7.2-rc/apache/apache2-foreground b/7.2-rc/apache/apache2-foreground new file mode 100755 index 00000000..5fe22e26 --- /dev/null +++ b/7.2-rc/apache/apache2-foreground @@ -0,0 +1,40 @@ +#!/bin/bash +set -e + +# Note: we don't just use "apache2ctl" here because it itself is just a shell-script wrapper around apache2 which provides extra functionality like "apache2ctl start" for launching apache2 in the background. +# (also, when run as "apache2ctl ", it does not use "exec", which leaves an undesirable resident shell process) + +: "${APACHE_CONFDIR:=/etc/apache2}" +: "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}" +if test -f "$APACHE_ENVVARS"; then + . "$APACHE_ENVVARS" +fi + +# Apache gets grumpy about PID files pre-existing +: "${APACHE_RUN_DIR:=/var/run/apache2}" +: "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}" +rm -f "$APACHE_PID_FILE" + +# create missing directories +# (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR) +for e in "${!APACHE_@}"; do + if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then + # handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir + # mkdir: cannot create directory '/var/lock': File exists + dir="${!e}" + while [ "$dir" != "$(dirname "$dir")" ]; do + dir="$(dirname "$dir")" + if [ -d "$dir" ]; then + break + fi + absDir="$(readlink -f "$dir" 2>/dev/null || :)" + if [ -n "$absDir" ]; then + mkdir -p "$absDir" + fi + done + + mkdir -p "${!e}" + fi +done + +exec apache2 -DFOREGROUND "$@" diff --git a/7.2-rc/apache/docker-php-entrypoint b/7.2-rc/apache/docker-php-entrypoint new file mode 100755 index 00000000..3d36d5e8 --- /dev/null +++ b/7.2-rc/apache/docker-php-entrypoint @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- apache2-foreground "$@" +fi + +exec "$@" diff --git a/7.2-rc/apache/docker-php-ext-configure b/7.2-rc/apache/docker-php-ext-configure new file mode 100755 index 00000000..375afd40 --- /dev/null +++ b/7.2-rc/apache/docker-php-ext-configure @@ -0,0 +1,63 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +ext="$1" +if [ -z "$ext" ] || [ ! -d "$ext" ]; 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:' + find /usr/src/php/ext \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + exit 1 +fi +shift + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS + fi +fi + +if command -v dpkg-architecture > /dev/null; then + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" + set -- --build="$gnuArch" "$@" +fi + +set -x +cd "$ext" +phpize +./configure "$@" diff --git a/7.2-rc/apache/docker-php-ext-enable b/7.2-rc/apache/docker-php-ext-enable new file mode 100755 index 00000000..0acb79df --- /dev/null +++ b/7.2-rc/apache/docker-php-ext-enable @@ -0,0 +1,104 @@ +#!/bin/sh +set -e + +cd "$(php -r 'echo ini_get("extension_dir");')" + +usage() { + echo "usage: $0 [options] module-name [module-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 --ini-name 0-apc.ini apcu apc" + echo + echo 'Possible values for module-name:' + echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) +} + +opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +modules= +for module; do + if [ -z "$module" ]; then + continue + fi + if [ -f "$module.so" ] && ! [ -f "$module" ]; then + # allow ".so" to be optional + module="$module.so" + fi + if ! [ -f "$module" ]; then + echo >&2 "error: $(readlink -f "$module") does not exist" + echo >&2 + usage >&2 + exit 1 + fi + modules="$modules $module" +done + +if [ -z "$modules" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils + apkDel='.docker-php-ext-enable-deps' + fi +fi + +for module in $modules; do + if nm -g "$module" | grep -q ' zend_extension_entry$'; then + # https://wiki.php.net/internals/extensions#loading_zend_extensions + line="zend_extension=$(readlink -f "$module")" + else + line="extension=$module" + fi + + ext="$(basename "$module")" + ext="${ext%.*}" + if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then + # this isn't perfect, but it's better than nothing + # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') + echo >&2 + echo >&2 "warning: $ext ($module) is already loaded!" + echo >&2 + continue + fi + + ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" + if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi diff --git a/7.2-rc/apache/docker-php-ext-install b/7.2-rc/apache/docker-php-ext-install new file mode 100755 index 00000000..c0660230 --- /dev/null +++ b/7.2-rc/apache/docker-php-ext-install @@ -0,0 +1,119 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs +} + +opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make -j"$j" + make -j"$j" install + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' ';' \ + | xargs -r docker-php-ext-enable + make -j"$j" clean + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.2-rc/apache/docker-php-source b/7.2-rc/apache/docker-php-source new file mode 100755 index 00000000..9033d243 --- /dev/null +++ b/7.2-rc/apache/docker-php-source @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +dir=/usr/src/php + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Manage php source tarball lifecycle." + echo + echo "Commands:" + echo " extract extract php source tarball into directory $dir if not already done." + echo " delete delete extracted php source located into $dir if not already done." + echo +} + +case "$1" in + extract) + mkdir -p "$dir" + if [ ! -f "$dir/.docker-extracted" ]; then + tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 + touch "$dir/.docker-extracted" + fi + ;; + + delete) + rm -rf "$dir" + ;; + + *) + usage + exit 1 + ;; +esac diff --git a/7.2-rc/docker-php-entrypoint b/7.2-rc/docker-php-entrypoint new file mode 100755 index 00000000..88a016c1 --- /dev/null +++ b/7.2-rc/docker-php-entrypoint @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- php "$@" +fi + +exec "$@" diff --git a/7.2-rc/docker-php-ext-configure b/7.2-rc/docker-php-ext-configure new file mode 100755 index 00000000..375afd40 --- /dev/null +++ b/7.2-rc/docker-php-ext-configure @@ -0,0 +1,63 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +ext="$1" +if [ -z "$ext" ] || [ ! -d "$ext" ]; 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:' + find /usr/src/php/ext \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + exit 1 +fi +shift + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS + fi +fi + +if command -v dpkg-architecture > /dev/null; then + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" + set -- --build="$gnuArch" "$@" +fi + +set -x +cd "$ext" +phpize +./configure "$@" diff --git a/7.2-rc/docker-php-ext-enable b/7.2-rc/docker-php-ext-enable new file mode 100755 index 00000000..0acb79df --- /dev/null +++ b/7.2-rc/docker-php-ext-enable @@ -0,0 +1,104 @@ +#!/bin/sh +set -e + +cd "$(php -r 'echo ini_get("extension_dir");')" + +usage() { + echo "usage: $0 [options] module-name [module-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 --ini-name 0-apc.ini apcu apc" + echo + echo 'Possible values for module-name:' + echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) +} + +opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +modules= +for module; do + if [ -z "$module" ]; then + continue + fi + if [ -f "$module.so" ] && ! [ -f "$module" ]; then + # allow ".so" to be optional + module="$module.so" + fi + if ! [ -f "$module" ]; then + echo >&2 "error: $(readlink -f "$module") does not exist" + echo >&2 + usage >&2 + exit 1 + fi + modules="$modules $module" +done + +if [ -z "$modules" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils + apkDel='.docker-php-ext-enable-deps' + fi +fi + +for module in $modules; do + if nm -g "$module" | grep -q ' zend_extension_entry$'; then + # https://wiki.php.net/internals/extensions#loading_zend_extensions + line="zend_extension=$(readlink -f "$module")" + else + line="extension=$module" + fi + + ext="$(basename "$module")" + ext="${ext%.*}" + if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then + # this isn't perfect, but it's better than nothing + # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') + echo >&2 + echo >&2 "warning: $ext ($module) is already loaded!" + echo >&2 + continue + fi + + ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" + if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi diff --git a/7.2-rc/docker-php-ext-install b/7.2-rc/docker-php-ext-install new file mode 100755 index 00000000..c0660230 --- /dev/null +++ b/7.2-rc/docker-php-ext-install @@ -0,0 +1,119 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs +} + +opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make -j"$j" + make -j"$j" install + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' ';' \ + | xargs -r docker-php-ext-enable + make -j"$j" clean + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.2-rc/docker-php-source b/7.2-rc/docker-php-source new file mode 100755 index 00000000..9033d243 --- /dev/null +++ b/7.2-rc/docker-php-source @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +dir=/usr/src/php + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Manage php source tarball lifecycle." + echo + echo "Commands:" + echo " extract extract php source tarball into directory $dir if not already done." + echo " delete delete extracted php source located into $dir if not already done." + echo +} + +case "$1" in + extract) + mkdir -p "$dir" + if [ ! -f "$dir/.docker-extracted" ]; then + tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 + touch "$dir/.docker-extracted" + fi + ;; + + delete) + rm -rf "$dir" + ;; + + *) + usage + exit 1 + ;; +esac diff --git a/7.2-rc/fpm/Dockerfile b/7.2-rc/fpm/Dockerfile new file mode 100644 index 00000000..76b46561 --- /dev/null +++ b/7.2-rc/fpm/Dockerfile @@ -0,0 +1,200 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:stretch-slim + +# persistent / runtime deps +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + libpcre3-dev \ + make \ + pkg-config \ + re2c +RUN apt-get update && apt-get install -y \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + libedit2 \ + libsqlite3-0 \ + libxml2 \ + xz-utils \ + --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 + +#### +ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F + +ENV PHP_VERSION 7.2.0alpha3 +ENV PHP_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz" PHP_ASC_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz.asc" +ENV PHP_SHA256="68abd6fc51cc5cfc7a7b1c2153644c7052f3ed841c21519095dda24eee67f63b" PHP_MD5="" + +RUN set -xe; \ + \ + fetchDeps=' \ + wget \ + '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ + apt-get update; \ + apt-get install -y --no-install-recommends $fetchDeps; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + wget -O php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + wget -O php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps + +COPY docker-php-source /usr/local/bin/ + +RUN set -xe \ + && buildDeps=" \ + $PHP_EXTRA_BUILD_DEPS \ + libcurl4-openssl-dev \ + libedit-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + " \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + && docker-php-source extract \ + && cd /usr/src/php \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ + && ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ + --disable-cgi \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# bundled pcre is too old for s390x (which isn't exactly a good sign) +# /usr/src/php/ext/pcre/pcrelib/pcre_jit_compile.c:65:2: error: #error Unsupported architecture + --with-pcre-regex=/usr \ + --with-libdir="lib/$debMultiarch" \ + \ + $PHP_EXTRA_CONFIGURE_ARGS \ + && make -j "$(nproc)" \ + && make install \ + && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ + && make clean \ + && cd / \ + && docker-php-source delete \ + \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ + \ +# https://github.com/docker-library/php/issues/443 + && pecl update-channels \ + && rm -rf /tmp/pear ~/.pearrc + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +ENTRYPOINT ["docker-php-entrypoint"] +#### +WORKDIR /var/www/html + +RUN set -ex \ + && cd /usr/local/etc \ + && if [ -d php-fpm.d ]; then \ + # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" + sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ + cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + else \ + # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency + mkdir php-fpm.d; \ + cp php-fpm.conf.default php-fpm.d/www.conf; \ + { \ + echo '[global]'; \ + echo 'include=etc/php-fpm.d/*.conf'; \ + } | tee php-fpm.conf; \ + fi \ + && { \ + echo '[global]'; \ + echo 'error_log = /proc/self/fd/2'; \ + echo; \ + echo '[www]'; \ + echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo 'access.log = /proc/self/fd/2'; \ + echo; \ + echo 'clear_env = no'; \ + echo; \ + echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ + echo 'catch_workers_output = yes'; \ + } | tee php-fpm.d/docker.conf \ + && { \ + echo '[global]'; \ + echo 'daemonize = no'; \ + echo; \ + echo '[www]'; \ + echo 'listen = [::]:9000'; \ + } | tee php-fpm.d/zz-docker.conf + +EXPOSE 9000 +CMD ["php-fpm"] +#### diff --git a/7.2-rc/fpm/alpine/Dockerfile b/7.2-rc/fpm/alpine/Dockerfile new file mode 100644 index 00000000..44ae7dbd --- /dev/null +++ b/7.2-rc/fpm/alpine/Dockerfile @@ -0,0 +1,198 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.6 + +# persistent / runtime deps +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pcre-dev \ + pkgconf \ + re2c +RUN apk add --no-cache --virtual .persistent-deps \ + ca-certificates \ + curl \ + tar \ + xz + +# ensure www-data user exists +RUN set -x \ + && addgroup -g 82 -S www-data \ + && adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2 +# http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2 +# http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2 + +ENV PHP_INI_DIR /usr/local/etc/php +RUN mkdir -p $PHP_INI_DIR/conf.d + +#### +ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F + +ENV PHP_VERSION 7.2.0alpha3 +ENV PHP_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz" PHP_ASC_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz.asc" +ENV PHP_SHA256="68abd6fc51cc5cfc7a7b1c2153644c7052f3ed841c21519095dda24eee67f63b" PHP_MD5="" + +RUN set -xe; \ + \ + apk add --no-cache --virtual .fetch-deps \ + gnupg \ + openssl \ + ; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + wget -O php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + wget -O php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apk del .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -xe \ + && apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + coreutils \ + curl-dev \ + libedit-dev \ + libxml2-dev \ + openssl-dev \ + sqlite-dev \ + \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + && docker-php-source extract \ + && cd /usr/src/php \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ + --disable-cgi \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# bundled pcre is too old for s390x (which isn't exactly a good sign) +# /usr/src/php/ext/pcre/pcrelib/pcre_jit_compile.c:65:2: error: #error Unsupported architecture + --with-pcre-regex=/usr \ + \ + $PHP_EXTRA_CONFIGURE_ARGS \ + && make -j "$(nproc)" \ + && make install \ + && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \ + && make clean \ + && cd / \ + && docker-php-source delete \ + \ + && runDeps="$( \ + scanelf --needed --nobanner --recursive /usr/local \ + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ + | sort -u \ + | xargs -r apk info --installed \ + | sort -u \ + )" \ + && apk add --no-cache --virtual .php-rundeps $runDeps \ + \ + && apk del .build-deps \ + \ +# https://github.com/docker-library/php/issues/443 + && pecl update-channels \ + && rm -rf /tmp/pear ~/.pearrc + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +ENTRYPOINT ["docker-php-entrypoint"] +#### +WORKDIR /var/www/html + +RUN set -ex \ + && cd /usr/local/etc \ + && if [ -d php-fpm.d ]; then \ + # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" + sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ + cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ + else \ + # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency + mkdir php-fpm.d; \ + cp php-fpm.conf.default php-fpm.d/www.conf; \ + { \ + echo '[global]'; \ + echo 'include=etc/php-fpm.d/*.conf'; \ + } | tee php-fpm.conf; \ + fi \ + && { \ + echo '[global]'; \ + echo 'error_log = /proc/self/fd/2'; \ + echo; \ + echo '[www]'; \ + echo '; if we send this to /proc/self/fd/1, it never appears'; \ + echo 'access.log = /proc/self/fd/2'; \ + echo; \ + echo 'clear_env = no'; \ + echo; \ + echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ + echo 'catch_workers_output = yes'; \ + } | tee php-fpm.d/docker.conf \ + && { \ + echo '[global]'; \ + echo 'daemonize = no'; \ + echo; \ + echo '[www]'; \ + echo 'listen = [::]:9000'; \ + } | tee php-fpm.d/zz-docker.conf + +EXPOSE 9000 +CMD ["php-fpm"] +#### diff --git a/7.2-rc/fpm/alpine/docker-php-entrypoint b/7.2-rc/fpm/alpine/docker-php-entrypoint new file mode 100755 index 00000000..86343d80 --- /dev/null +++ b/7.2-rc/fpm/alpine/docker-php-entrypoint @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- php-fpm "$@" +fi + +exec "$@" diff --git a/7.2-rc/fpm/alpine/docker-php-ext-configure b/7.2-rc/fpm/alpine/docker-php-ext-configure new file mode 100755 index 00000000..375afd40 --- /dev/null +++ b/7.2-rc/fpm/alpine/docker-php-ext-configure @@ -0,0 +1,63 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +ext="$1" +if [ -z "$ext" ] || [ ! -d "$ext" ]; 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:' + find /usr/src/php/ext \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + exit 1 +fi +shift + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS + fi +fi + +if command -v dpkg-architecture > /dev/null; then + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" + set -- --build="$gnuArch" "$@" +fi + +set -x +cd "$ext" +phpize +./configure "$@" diff --git a/7.2-rc/fpm/alpine/docker-php-ext-enable b/7.2-rc/fpm/alpine/docker-php-ext-enable new file mode 100755 index 00000000..0acb79df --- /dev/null +++ b/7.2-rc/fpm/alpine/docker-php-ext-enable @@ -0,0 +1,104 @@ +#!/bin/sh +set -e + +cd "$(php -r 'echo ini_get("extension_dir");')" + +usage() { + echo "usage: $0 [options] module-name [module-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 --ini-name 0-apc.ini apcu apc" + echo + echo 'Possible values for module-name:' + echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) +} + +opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +modules= +for module; do + if [ -z "$module" ]; then + continue + fi + if [ -f "$module.so" ] && ! [ -f "$module" ]; then + # allow ".so" to be optional + module="$module.so" + fi + if ! [ -f "$module" ]; then + echo >&2 "error: $(readlink -f "$module") does not exist" + echo >&2 + usage >&2 + exit 1 + fi + modules="$modules $module" +done + +if [ -z "$modules" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils + apkDel='.docker-php-ext-enable-deps' + fi +fi + +for module in $modules; do + if nm -g "$module" | grep -q ' zend_extension_entry$'; then + # https://wiki.php.net/internals/extensions#loading_zend_extensions + line="zend_extension=$(readlink -f "$module")" + else + line="extension=$module" + fi + + ext="$(basename "$module")" + ext="${ext%.*}" + if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then + # this isn't perfect, but it's better than nothing + # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') + echo >&2 + echo >&2 "warning: $ext ($module) is already loaded!" + echo >&2 + continue + fi + + ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" + if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi diff --git a/7.2-rc/fpm/alpine/docker-php-ext-install b/7.2-rc/fpm/alpine/docker-php-ext-install new file mode 100755 index 00000000..c0660230 --- /dev/null +++ b/7.2-rc/fpm/alpine/docker-php-ext-install @@ -0,0 +1,119 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs +} + +opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make -j"$j" + make -j"$j" install + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' ';' \ + | xargs -r docker-php-ext-enable + make -j"$j" clean + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.2-rc/fpm/alpine/docker-php-source b/7.2-rc/fpm/alpine/docker-php-source new file mode 100755 index 00000000..9033d243 --- /dev/null +++ b/7.2-rc/fpm/alpine/docker-php-source @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +dir=/usr/src/php + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Manage php source tarball lifecycle." + echo + echo "Commands:" + echo " extract extract php source tarball into directory $dir if not already done." + echo " delete delete extracted php source located into $dir if not already done." + echo +} + +case "$1" in + extract) + mkdir -p "$dir" + if [ ! -f "$dir/.docker-extracted" ]; then + tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 + touch "$dir/.docker-extracted" + fi + ;; + + delete) + rm -rf "$dir" + ;; + + *) + usage + exit 1 + ;; +esac diff --git a/7.2-rc/fpm/docker-php-entrypoint b/7.2-rc/fpm/docker-php-entrypoint new file mode 100755 index 00000000..86343d80 --- /dev/null +++ b/7.2-rc/fpm/docker-php-entrypoint @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- php-fpm "$@" +fi + +exec "$@" diff --git a/7.2-rc/fpm/docker-php-ext-configure b/7.2-rc/fpm/docker-php-ext-configure new file mode 100755 index 00000000..375afd40 --- /dev/null +++ b/7.2-rc/fpm/docker-php-ext-configure @@ -0,0 +1,63 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +ext="$1" +if [ -z "$ext" ] || [ ! -d "$ext" ]; 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:' + find /usr/src/php/ext \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + exit 1 +fi +shift + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS + fi +fi + +if command -v dpkg-architecture > /dev/null; then + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" + set -- --build="$gnuArch" "$@" +fi + +set -x +cd "$ext" +phpize +./configure "$@" diff --git a/7.2-rc/fpm/docker-php-ext-enable b/7.2-rc/fpm/docker-php-ext-enable new file mode 100755 index 00000000..0acb79df --- /dev/null +++ b/7.2-rc/fpm/docker-php-ext-enable @@ -0,0 +1,104 @@ +#!/bin/sh +set -e + +cd "$(php -r 'echo ini_get("extension_dir");')" + +usage() { + echo "usage: $0 [options] module-name [module-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 --ini-name 0-apc.ini apcu apc" + echo + echo 'Possible values for module-name:' + echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) +} + +opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +modules= +for module; do + if [ -z "$module" ]; then + continue + fi + if [ -f "$module.so" ] && ! [ -f "$module" ]; then + # allow ".so" to be optional + module="$module.so" + fi + if ! [ -f "$module" ]; then + echo >&2 "error: $(readlink -f "$module") does not exist" + echo >&2 + usage >&2 + exit 1 + fi + modules="$modules $module" +done + +if [ -z "$modules" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils + apkDel='.docker-php-ext-enable-deps' + fi +fi + +for module in $modules; do + if nm -g "$module" | grep -q ' zend_extension_entry$'; then + # https://wiki.php.net/internals/extensions#loading_zend_extensions + line="zend_extension=$(readlink -f "$module")" + else + line="extension=$module" + fi + + ext="$(basename "$module")" + ext="${ext%.*}" + if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then + # this isn't perfect, but it's better than nothing + # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') + echo >&2 + echo >&2 "warning: $ext ($module) is already loaded!" + echo >&2 + continue + fi + + ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" + if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi diff --git a/7.2-rc/fpm/docker-php-ext-install b/7.2-rc/fpm/docker-php-ext-install new file mode 100755 index 00000000..c0660230 --- /dev/null +++ b/7.2-rc/fpm/docker-php-ext-install @@ -0,0 +1,119 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs +} + +opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make -j"$j" + make -j"$j" install + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' ';' \ + | xargs -r docker-php-ext-enable + make -j"$j" clean + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.2-rc/fpm/docker-php-source b/7.2-rc/fpm/docker-php-source new file mode 100755 index 00000000..9033d243 --- /dev/null +++ b/7.2-rc/fpm/docker-php-source @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +dir=/usr/src/php + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Manage php source tarball lifecycle." + echo + echo "Commands:" + echo " extract extract php source tarball into directory $dir if not already done." + echo " delete delete extracted php source located into $dir if not already done." + echo +} + +case "$1" in + extract) + mkdir -p "$dir" + if [ ! -f "$dir/.docker-extracted" ]; then + tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 + touch "$dir/.docker-extracted" + fi + ;; + + delete) + rm -rf "$dir" + ;; + + *) + usage + exit 1 + ;; +esac diff --git a/7.2-rc/zts/Dockerfile b/7.2-rc/zts/Dockerfile new file mode 100644 index 00000000..1a3ed0e9 --- /dev/null +++ b/7.2-rc/zts/Dockerfile @@ -0,0 +1,161 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM debian:stretch-slim + +# persistent / runtime deps +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev \ + file \ + g++ \ + gcc \ + libc-dev \ + libpcre3-dev \ + make \ + pkg-config \ + re2c +RUN apt-get update && apt-get install -y \ + $PHPIZE_DEPS \ + ca-certificates \ + curl \ + libedit2 \ + libsqlite3-0 \ + libxml2 \ + xz-utils \ + --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 + +#### +ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F + +ENV PHP_VERSION 7.2.0alpha3 +ENV PHP_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz" PHP_ASC_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz.asc" +ENV PHP_SHA256="68abd6fc51cc5cfc7a7b1c2153644c7052f3ed841c21519095dda24eee67f63b" PHP_MD5="" + +RUN set -xe; \ + \ + fetchDeps=' \ + wget \ + '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ + apt-get update; \ + apt-get install -y --no-install-recommends $fetchDeps; \ + rm -rf /var/lib/apt/lists/*; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + wget -O php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + wget -O php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps + +COPY docker-php-source /usr/local/bin/ + +RUN set -xe \ + && buildDeps=" \ + $PHP_EXTRA_BUILD_DEPS \ + libcurl4-openssl-dev \ + libedit-dev \ + libsqlite3-dev \ + libssl-dev \ + libxml2-dev \ + zlib1g-dev \ + " \ + && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ + \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + && docker-php-source extract \ + && cd /usr/src/php \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ + && ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ + --disable-cgi \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# bundled pcre is too old for s390x (which isn't exactly a good sign) +# /usr/src/php/ext/pcre/pcrelib/pcre_jit_compile.c:65:2: error: #error Unsupported architecture + --with-pcre-regex=/usr \ + --with-libdir="lib/$debMultiarch" \ + \ + $PHP_EXTRA_CONFIGURE_ARGS \ + && make -j "$(nproc)" \ + && make install \ + && { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \ + && make clean \ + && cd / \ + && docker-php-source delete \ + \ + && apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps \ + \ +# https://github.com/docker-library/php/issues/443 + && pecl update-channels \ + && rm -rf /tmp/pear ~/.pearrc + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +ENTRYPOINT ["docker-php-entrypoint"] +#### +CMD ["php", "-a"] +#### diff --git a/7.2-rc/zts/alpine/Dockerfile b/7.2-rc/zts/alpine/Dockerfile new file mode 100644 index 00000000..42471d4a --- /dev/null +++ b/7.2-rc/zts/alpine/Dockerfile @@ -0,0 +1,159 @@ +# +# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" +# +# PLEASE DO NOT EDIT IT DIRECTLY. +# + +FROM alpine:3.6 + +# persistent / runtime deps +ENV PHPIZE_DEPS \ + autoconf \ + dpkg-dev dpkg \ + file \ + g++ \ + gcc \ + libc-dev \ + make \ + pcre-dev \ + pkgconf \ + re2c +RUN apk add --no-cache --virtual .persistent-deps \ + ca-certificates \ + curl \ + tar \ + xz + +# ensure www-data user exists +RUN set -x \ + && addgroup -g 82 -S www-data \ + && adduser -u 82 -D -S -G www-data www-data +# 82 is the standard uid/gid for "www-data" in Alpine +# http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2 +# http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2 +# http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2 + +ENV PHP_INI_DIR /usr/local/etc/php +RUN mkdir -p $PHP_INI_DIR/conf.d + +#### +ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts +#### + +# Apply stack smash protection to functions using local buffers and alloca() +# Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) +# Enable optimization (-O2) +# Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) +# Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) +# https://github.com/docker-library/php/issues/272 +ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" +ENV PHP_CPPFLAGS="$PHP_CFLAGS" +ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" + +ENV GPG_KEYS 1729F83938DA44E27BA0F4D3DBDB397470D12172 B1B44D8F021E4E2D6021E995DC9FF8D3EE5AF27F + +ENV PHP_VERSION 7.2.0alpha3 +ENV PHP_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz" PHP_ASC_URL="http://downloads.php.net/~remi/php-7.2.0alpha3.tar.xz.asc" +ENV PHP_SHA256="68abd6fc51cc5cfc7a7b1c2153644c7052f3ed841c21519095dda24eee67f63b" PHP_MD5="" + +RUN set -xe; \ + \ + apk add --no-cache --virtual .fetch-deps \ + gnupg \ + openssl \ + ; \ + \ + mkdir -p /usr/src; \ + cd /usr/src; \ + \ + wget -O php.tar.xz "$PHP_URL"; \ + \ + if [ -n "$PHP_SHA256" ]; then \ + echo "$PHP_SHA256 *php.tar.xz" | sha256sum -c -; \ + fi; \ + if [ -n "$PHP_MD5" ]; then \ + echo "$PHP_MD5 *php.tar.xz" | md5sum -c -; \ + fi; \ + \ + if [ -n "$PHP_ASC_URL" ]; then \ + wget -O php.tar.xz.asc "$PHP_ASC_URL"; \ + export GNUPGHOME="$(mktemp -d)"; \ + for key in $GPG_KEYS; do \ + gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ + done; \ + gpg --batch --verify php.tar.xz.asc php.tar.xz; \ + rm -rf "$GNUPGHOME"; \ + fi; \ + \ + apk del .fetch-deps + +COPY docker-php-source /usr/local/bin/ + +RUN set -xe \ + && apk add --no-cache --virtual .build-deps \ + $PHPIZE_DEPS \ + coreutils \ + curl-dev \ + libedit-dev \ + libxml2-dev \ + openssl-dev \ + sqlite-dev \ + \ + && export CFLAGS="$PHP_CFLAGS" \ + CPPFLAGS="$PHP_CPPFLAGS" \ + LDFLAGS="$PHP_LDFLAGS" \ + && docker-php-source extract \ + && cd /usr/src/php \ + && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ + && ./configure \ + --build="$gnuArch" \ + --with-config-file-path="$PHP_INI_DIR" \ + --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ + \ + --disable-cgi \ + \ +# --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) + --enable-ftp \ +# --enable-mbstring is included here because otherwise there's no way to get pecl to use it properly (see https://github.com/docker-library/php/issues/195) + --enable-mbstring \ +# --enable-mysqlnd is included here because it's harder to compile after the fact than extensions are (since it's a plugin for several extensions, not an extension in itself) + --enable-mysqlnd \ + \ + --with-curl \ + --with-libedit \ + --with-openssl \ + --with-zlib \ + \ +# bundled pcre is too old for s390x (which isn't exactly a good sign) +# /usr/src/php/ext/pcre/pcrelib/pcre_jit_compile.c:65:2: error: #error Unsupported architecture + --with-pcre-regex=/usr \ + \ + $PHP_EXTRA_CONFIGURE_ARGS \ + && make -j "$(nproc)" \ + && make install \ + && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \ + && make clean \ + && cd / \ + && docker-php-source delete \ + \ + && runDeps="$( \ + scanelf --needed --nobanner --recursive /usr/local \ + | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ + | sort -u \ + | xargs -r apk info --installed \ + | sort -u \ + )" \ + && apk add --no-cache --virtual .php-rundeps $runDeps \ + \ + && apk del .build-deps \ + \ +# https://github.com/docker-library/php/issues/443 + && pecl update-channels \ + && rm -rf /tmp/pear ~/.pearrc + +COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ + +ENTRYPOINT ["docker-php-entrypoint"] +#### +CMD ["php", "-a"] +#### diff --git a/7.2-rc/zts/alpine/docker-php-entrypoint b/7.2-rc/zts/alpine/docker-php-entrypoint new file mode 100755 index 00000000..88a016c1 --- /dev/null +++ b/7.2-rc/zts/alpine/docker-php-entrypoint @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- php "$@" +fi + +exec "$@" diff --git a/7.2-rc/zts/alpine/docker-php-ext-configure b/7.2-rc/zts/alpine/docker-php-ext-configure new file mode 100755 index 00000000..375afd40 --- /dev/null +++ b/7.2-rc/zts/alpine/docker-php-ext-configure @@ -0,0 +1,63 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +ext="$1" +if [ -z "$ext" ] || [ ! -d "$ext" ]; 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:' + find /usr/src/php/ext \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + exit 1 +fi +shift + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS + fi +fi + +if command -v dpkg-architecture > /dev/null; then + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" + set -- --build="$gnuArch" "$@" +fi + +set -x +cd "$ext" +phpize +./configure "$@" diff --git a/7.2-rc/zts/alpine/docker-php-ext-enable b/7.2-rc/zts/alpine/docker-php-ext-enable new file mode 100755 index 00000000..0acb79df --- /dev/null +++ b/7.2-rc/zts/alpine/docker-php-ext-enable @@ -0,0 +1,104 @@ +#!/bin/sh +set -e + +cd "$(php -r 'echo ini_get("extension_dir");')" + +usage() { + echo "usage: $0 [options] module-name [module-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 --ini-name 0-apc.ini apcu apc" + echo + echo 'Possible values for module-name:' + echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) +} + +opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +modules= +for module; do + if [ -z "$module" ]; then + continue + fi + if [ -f "$module.so" ] && ! [ -f "$module" ]; then + # allow ".so" to be optional + module="$module.so" + fi + if ! [ -f "$module" ]; then + echo >&2 "error: $(readlink -f "$module") does not exist" + echo >&2 + usage >&2 + exit 1 + fi + modules="$modules $module" +done + +if [ -z "$modules" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils + apkDel='.docker-php-ext-enable-deps' + fi +fi + +for module in $modules; do + if nm -g "$module" | grep -q ' zend_extension_entry$'; then + # https://wiki.php.net/internals/extensions#loading_zend_extensions + line="zend_extension=$(readlink -f "$module")" + else + line="extension=$module" + fi + + ext="$(basename "$module")" + ext="${ext%.*}" + if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then + # this isn't perfect, but it's better than nothing + # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') + echo >&2 + echo >&2 "warning: $ext ($module) is already loaded!" + echo >&2 + continue + fi + + ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" + if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi diff --git a/7.2-rc/zts/alpine/docker-php-ext-install b/7.2-rc/zts/alpine/docker-php-ext-install new file mode 100755 index 00000000..c0660230 --- /dev/null +++ b/7.2-rc/zts/alpine/docker-php-ext-install @@ -0,0 +1,119 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs +} + +opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make -j"$j" + make -j"$j" install + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' ';' \ + | xargs -r docker-php-ext-enable + make -j"$j" clean + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.2-rc/zts/alpine/docker-php-source b/7.2-rc/zts/alpine/docker-php-source new file mode 100755 index 00000000..9033d243 --- /dev/null +++ b/7.2-rc/zts/alpine/docker-php-source @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +dir=/usr/src/php + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Manage php source tarball lifecycle." + echo + echo "Commands:" + echo " extract extract php source tarball into directory $dir if not already done." + echo " delete delete extracted php source located into $dir if not already done." + echo +} + +case "$1" in + extract) + mkdir -p "$dir" + if [ ! -f "$dir/.docker-extracted" ]; then + tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 + touch "$dir/.docker-extracted" + fi + ;; + + delete) + rm -rf "$dir" + ;; + + *) + usage + exit 1 + ;; +esac diff --git a/7.2-rc/zts/docker-php-entrypoint b/7.2-rc/zts/docker-php-entrypoint new file mode 100755 index 00000000..88a016c1 --- /dev/null +++ b/7.2-rc/zts/docker-php-entrypoint @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +# first arg is `-f` or `--some-option` +if [ "${1#-}" != "$1" ]; then + set -- php "$@" +fi + +exec "$@" diff --git a/7.2-rc/zts/docker-php-ext-configure b/7.2-rc/zts/docker-php-ext-configure new file mode 100755 index 00000000..375afd40 --- /dev/null +++ b/7.2-rc/zts/docker-php-ext-configure @@ -0,0 +1,63 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +ext="$1" +if [ -z "$ext" ] || [ ! -d "$ext" ]; 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:' + find /usr/src/php/ext \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs + exit 1 +fi +shift + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS + fi +fi + +if command -v dpkg-architecture > /dev/null; then + gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" + set -- --build="$gnuArch" "$@" +fi + +set -x +cd "$ext" +phpize +./configure "$@" diff --git a/7.2-rc/zts/docker-php-ext-enable b/7.2-rc/zts/docker-php-ext-enable new file mode 100755 index 00000000..0acb79df --- /dev/null +++ b/7.2-rc/zts/docker-php-ext-enable @@ -0,0 +1,104 @@ +#!/bin/sh +set -e + +cd "$(php -r 'echo ini_get("extension_dir");')" + +usage() { + echo "usage: $0 [options] module-name [module-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 --ini-name 0-apc.ini apcu apc" + echo + echo 'Possible values for module-name:' + echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) +} + +opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +iniName= +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --ini-name) iniName="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +modules= +for module; do + if [ -z "$module" ]; then + continue + fi + if [ -f "$module.so" ] && ! [ -f "$module" ]; then + # allow ".so" to be optional + module="$module.so" + fi + if ! [ -f "$module" ]; then + echo >&2 "error: $(readlink -f "$module") does not exist" + echo >&2 + usage >&2 + exit 1 + fi + modules="$modules $module" +done + +if [ -z "$modules" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if \ + [ -n "$PHPIZE_DEPS" ] \ + && ! apk info --installed .phpize-deps > /dev/null \ + && ! apk info --installed .phpize-deps-configure > /dev/null \ + ; then + apk add --no-cache --virtual '.docker-php-ext-enable-deps' binutils + apkDel='.docker-php-ext-enable-deps' + fi +fi + +for module in $modules; do + if nm -g "$module" | grep -q ' zend_extension_entry$'; then + # https://wiki.php.net/internals/extensions#loading_zend_extensions + line="zend_extension=$(readlink -f "$module")" + else + line="extension=$module" + fi + + ext="$(basename "$module")" + ext="${ext%.*}" + if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then + # this isn't perfect, but it's better than nothing + # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') + echo >&2 + echo >&2 "warning: $ext ($module) is already loaded!" + echo >&2 + continue + fi + + ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" + if ! grep -q "$line" "$ini" 2>/dev/null; then + echo "$line" >> "$ini" + fi +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi diff --git a/7.2-rc/zts/docker-php-ext-install b/7.2-rc/zts/docker-php-ext-install new file mode 100755 index 00000000..c0660230 --- /dev/null +++ b/7.2-rc/zts/docker-php-ext-install @@ -0,0 +1,119 @@ +#!/bin/sh +set -e + +# prefer user supplied CFLAGS, but default to our PHP_CFLAGS +: ${CFLAGS:=$PHP_CFLAGS} +: ${CPPFLAGS:=$PHP_CPPFLAGS} +: ${LDFLAGS:=$PHP_LDFLAGS} +export CFLAGS CPPFLAGS LDFLAGS + +srcExists= +if [ -d /usr/src/php ]; then + srcExists=1 +fi +docker-php-source extract +if [ -z "$srcExists" ]; then + touch /usr/src/php/.docker-delete-me +fi + +cd /usr/src/php/ext + +usage() { + echo "usage: $0 [-jN] ext-name [ext-name ...]" + echo " ie: $0 gd mysqli" + echo " $0 pdo pdo_mysql" + echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" + echo + echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' + echo + echo 'Possible values for ext-name:' + find . \ + -mindepth 2 \ + -maxdepth 2 \ + -type f \ + -name 'config.m4' \ + | xargs -n1 dirname \ + | xargs -n1 basename \ + | sort \ + | xargs +} + +opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" +eval set -- "$opts" + +j=1 +while true; do + flag="$1" + shift + case "$flag" in + --help|-h|'-?') usage && exit 0 ;; + --jobs|-j) j="$1" && shift ;; + --) break ;; + *) + { + echo "error: unknown flag: $flag" + usage + } >&2 + exit 1 + ;; + esac +done + +exts= +for ext; do + if [ -z "$ext" ]; then + continue + fi + if [ ! -d "$ext" ]; then + echo >&2 "error: $PWD/$ext does not exist" + echo >&2 + usage >&2 + exit 1 + fi + exts="$exts $ext" +done + +if [ -z "$exts" ]; then + usage >&2 + exit 1 +fi + +pm='unknown' +if [ -e /lib/apk/db/installed ]; then + pm='apk' +fi + +apkDel= +if [ "$pm" = 'apk' ]; then + if [ -n "$PHPIZE_DEPS" ]; then + if apk info --installed .phpize-deps-configure > /dev/null; then + apkDel='.phpize-deps-configure' + elif ! apk info --installed .phpize-deps > /dev/null; then + apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS + apkDel='.phpize-deps' + fi + fi +fi + +popDir="$PWD" +for ext in $exts; do + cd "$ext" + [ -e Makefile ] || docker-php-ext-configure "$ext" + make -j"$j" + make -j"$j" install + find modules \ + -maxdepth 1 \ + -name '*.so' \ + -exec basename '{}' ';' \ + | xargs -r docker-php-ext-enable + make -j"$j" clean + cd "$popDir" +done + +if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then + apk del $apkDel +fi + +if [ -e /usr/src/php/.docker-delete-me ]; then + docker-php-source delete +fi diff --git a/7.2-rc/zts/docker-php-source b/7.2-rc/zts/docker-php-source new file mode 100755 index 00000000..9033d243 --- /dev/null +++ b/7.2-rc/zts/docker-php-source @@ -0,0 +1,34 @@ +#!/bin/sh +set -e + +dir=/usr/src/php + +usage() { + echo "usage: $0 COMMAND" + echo + echo "Manage php source tarball lifecycle." + echo + echo "Commands:" + echo " extract extract php source tarball into directory $dir if not already done." + echo " delete delete extracted php source located into $dir if not already done." + echo +} + +case "$1" in + extract) + mkdir -p "$dir" + if [ ! -f "$dir/.docker-extracted" ]; then + tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 + touch "$dir/.docker-extracted" + fi + ;; + + delete) + rm -rf "$dir" + ;; + + *) + usage + exit 1 + ;; +esac diff --git a/Dockerfile-alpine.template b/Dockerfile-alpine.template index a39dce05..324c2bba 100644 --- a/Dockerfile-alpine.template +++ b/Dockerfile-alpine.template @@ -75,7 +75,7 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ apk del .fetch-deps diff --git a/Dockerfile-debian.template b/Dockerfile-debian.template index 45587249..230abc26 100644 --- a/Dockerfile-debian.template +++ b/Dockerfile-debian.template @@ -49,6 +49,12 @@ RUN set -xe; \ fetchDeps=' \ wget \ '; \ + if ! command -v gpg > /dev/null; then \ + fetchDeps="$fetchDeps \ + dirmngr \ + gnupg2 \ + "; \ + fi; \ apt-get update; \ apt-get install -y --no-install-recommends $fetchDeps; \ rm -rf /var/lib/apt/lists/*; \ @@ -72,10 +78,10 @@ RUN set -xe; \ gpg --keyserver ha.pool.sks-keyservers.net --recv-keys "$key"; \ done; \ gpg --batch --verify php.tar.xz.asc php.tar.xz; \ - rm -r "$GNUPGHOME"; \ + rm -rf "$GNUPGHOME"; \ fi; \ \ - apt-get purge -y --auto-remove $fetchDeps + apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $fetchDeps COPY docker-php-source /usr/local/bin/ @@ -87,6 +93,7 @@ RUN set -xe \ libsqlite3-dev \ libssl-dev \ libxml2-dev \ + zlib1g-dev \ " \ && apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \ \ @@ -97,6 +104,10 @@ RUN set -xe \ && cd /usr/src/php \ && gnuArch="$(dpkg-architecture --query DEB_BUILD_GNU_TYPE)" \ && debMultiarch="$(dpkg-architecture --query DEB_BUILD_MULTIARCH)" \ +# https://bugs.php.net/bug.php?id=74125 + && if [ ! -d /usr/include/curl ]; then \ + ln -sT "/usr/include/$debMultiarch/curl" /usr/local/include/curl; \ + fi \ && ./configure \ --build="$gnuArch" \ --with-config-file-path="$PHP_INI_DIR" \ diff --git a/update.sh b/update.sh index 183f4c34..53ec9aac 100755 --- a/update.sh +++ b/update.sh @@ -29,7 +29,7 @@ declare -A gpgKeys=( ) # see https://secure.php.net/downloads.php -defaultDebianSuite='stretch' +defaultDebianSuite='stretch-slim' declare -A debianSuites=( [5.6]='jessie' [7.0]='jessie'