mirror of
https://github.com/docker-library/php.git
synced 2025-08-12 02:36:20 +00:00
Add PHP 7.1.0RC1
This commit is contained in:
@ -2,6 +2,13 @@ language: bash
|
|||||||
services: docker
|
services: docker
|
||||||
|
|
||||||
env:
|
env:
|
||||||
|
- VERSION=7.1 VARIANT=
|
||||||
|
- VERSION=7.1 VARIANT=alpine
|
||||||
|
- VERSION=7.1 VARIANT=apache
|
||||||
|
- VERSION=7.1 VARIANT=fpm
|
||||||
|
- VERSION=7.1 VARIANT=fpm/alpine
|
||||||
|
- VERSION=7.1 VARIANT=zts
|
||||||
|
- VERSION=7.1 VARIANT=zts/alpine
|
||||||
- VERSION=7.0 VARIANT=
|
- VERSION=7.0 VARIANT=
|
||||||
- VERSION=7.0 VARIANT=alpine
|
- VERSION=7.0 VARIANT=alpine
|
||||||
- VERSION=7.0 VARIANT=apache
|
- VERSION=7.0 VARIANT=apache
|
||||||
|
97
7.1/Dockerfile
Normal file
97
7.1/Dockerfile
Normal file
@ -0,0 +1,97 @@
|
|||||||
|
#
|
||||||
|
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
|
||||||
|
#
|
||||||
|
# PLEASE DO NOT EDIT IT DIRECTLY.
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM debian:jessie
|
||||||
|
|
||||||
|
# persistent / runtime deps
|
||||||
|
ENV PHPIZE_DEPS \
|
||||||
|
autoconf \
|
||||||
|
file \
|
||||||
|
g++ \
|
||||||
|
gcc \
|
||||||
|
libc-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
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
##</autogenerated>##
|
||||||
|
|
||||||
|
ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0
|
||||||
|
|
||||||
|
ENV PHP_VERSION 7.1.0RC1
|
||||||
|
ENV PHP_FILENAME php-7.1.0RC1.tar.xz
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& cd /usr/src \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME" -o php.tar.xz \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME.asc" -o php.tar.xz.asc \
|
||||||
|
&& 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 -r "$GNUPGHOME"
|
||||||
|
|
||||||
|
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 \
|
||||||
|
" \
|
||||||
|
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
|
||||||
|
\
|
||||||
|
&& docker-php-source extract \
|
||||||
|
&& cd /usr/src/php \
|
||||||
|
&& ./configure \
|
||||||
|
--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 \
|
||||||
|
\
|
||||||
|
$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 \
|
||||||
|
&& docker-php-source delete \
|
||||||
|
\
|
||||||
|
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps
|
||||||
|
|
||||||
|
COPY docker-php-ext-* /usr/local/bin/
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
CMD ["php", "-a"]
|
||||||
|
##</autogenerated>##
|
113
7.1/alpine/Dockerfile
Normal file
113
7.1/alpine/Dockerfile
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
#
|
||||||
|
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
|
||||||
|
#
|
||||||
|
# PLEASE DO NOT EDIT IT DIRECTLY.
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM alpine:3.4
|
||||||
|
|
||||||
|
# persistent / runtime deps
|
||||||
|
ENV PHPIZE_DEPS \
|
||||||
|
autoconf \
|
||||||
|
file \
|
||||||
|
g++ \
|
||||||
|
gcc \
|
||||||
|
libc-dev \
|
||||||
|
make \
|
||||||
|
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
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
##</autogenerated>##
|
||||||
|
|
||||||
|
ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0
|
||||||
|
|
||||||
|
ENV PHP_VERSION 7.1.0RC1
|
||||||
|
ENV PHP_FILENAME php-7.1.0RC1.tar.xz
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& apk add --no-cache --virtual .fetch-deps \
|
||||||
|
gnupg \
|
||||||
|
&& mkdir -p /usr/src \
|
||||||
|
&& cd /usr/src \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME" -o php.tar.xz \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME.asc" -o php.tar.xz.asc \
|
||||||
|
&& 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 -r "$GNUPGHOME" \
|
||||||
|
&& apk del .fetch-deps
|
||||||
|
|
||||||
|
COPY docker-php-source /usr/local/bin/
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& apk add --no-cache --virtual .build-deps \
|
||||||
|
$PHPIZE_DEPS \
|
||||||
|
curl-dev \
|
||||||
|
libedit-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
openssl-dev \
|
||||||
|
sqlite-dev \
|
||||||
|
\
|
||||||
|
&& docker-php-source extract \
|
||||||
|
&& cd /usr/src/php \
|
||||||
|
&& ./configure \
|
||||||
|
--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 \
|
||||||
|
\
|
||||||
|
$PHP_EXTRA_CONFIGURE_ARGS \
|
||||||
|
&& make -j"$(getconf _NPROCESSORS_ONLN)" \
|
||||||
|
&& make install \
|
||||||
|
&& { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \
|
||||||
|
&& make clean \
|
||||||
|
&& 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
|
||||||
|
|
||||||
|
COPY docker-php-ext-* /usr/local/bin/
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
CMD ["php", "-a"]
|
||||||
|
##</autogenerated>##
|
51
7.1/alpine/docker-php-ext-configure
Executable file
51
7.1/alpine/docker-php-ext-configure
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
ext="$1"
|
||||||
|
extDir="/usr/src/php/ext/$ext"
|
||||||
|
if [ -z "$ext" ] || [ ! -d "$extDir" ]; then
|
||||||
|
echo >&2 "usage: $0 ext-name [configure flags]"
|
||||||
|
echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
|
||||||
|
echo >&2
|
||||||
|
echo >&2 'Possible values for ext-name:'
|
||||||
|
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
|
||||||
|
|
||||||
|
set -x
|
||||||
|
cd "$extDir"
|
||||||
|
phpize
|
||||||
|
./configure "$@"
|
83
7.1/alpine/docker-php-ext-enable
Executable file
83
7.1/alpine/docker-php-ext-enable
Executable file
@ -0,0 +1,83 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
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
|
113
7.1/alpine/docker-php-ext-install
Executable file
113
7.1/alpine/docker-php-ext-install
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
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
|
34
7.1/alpine/docker-php-source
Executable file
34
7.1/alpine/docker-php-source
Executable file
@ -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
|
157
7.1/apache/Dockerfile
Normal file
157
7.1/apache/Dockerfile
Normal file
@ -0,0 +1,157 @@
|
|||||||
|
#
|
||||||
|
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
|
||||||
|
#
|
||||||
|
# PLEASE DO NOT EDIT IT DIRECTLY.
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM debian:jessie
|
||||||
|
|
||||||
|
# persistent / runtime deps
|
||||||
|
ENV PHPIZE_DEPS \
|
||||||
|
autoconf \
|
||||||
|
file \
|
||||||
|
g++ \
|
||||||
|
gcc \
|
||||||
|
libc-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
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
RUN apt-get update && apt-get install -y apache2-bin apache2.2-common --no-install-recommends && 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 '<FilesMatch \.php$>'; \
|
||||||
|
echo '\tSetHandler application/x-httpd-php'; \
|
||||||
|
echo '</FilesMatch>'; \
|
||||||
|
echo; \
|
||||||
|
echo 'DirectoryIndex disabled'; \
|
||||||
|
echo 'DirectoryIndex index.php index.html'; \
|
||||||
|
echo; \
|
||||||
|
echo '<Directory /var/www/>'; \
|
||||||
|
echo '\tOptions -Indexes'; \
|
||||||
|
echo '\tAllowOverride All'; \
|
||||||
|
echo '</Directory>'; \
|
||||||
|
} | 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
|
||||||
|
##</autogenerated>##
|
||||||
|
|
||||||
|
ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0
|
||||||
|
|
||||||
|
ENV PHP_VERSION 7.1.0RC1
|
||||||
|
ENV PHP_FILENAME php-7.1.0RC1.tar.xz
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& cd /usr/src \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME" -o php.tar.xz \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME.asc" -o php.tar.xz.asc \
|
||||||
|
&& 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 -r "$GNUPGHOME"
|
||||||
|
|
||||||
|
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 \
|
||||||
|
" \
|
||||||
|
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
|
||||||
|
\
|
||||||
|
&& docker-php-source extract \
|
||||||
|
&& cd /usr/src/php \
|
||||||
|
&& ./configure \
|
||||||
|
--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 \
|
||||||
|
\
|
||||||
|
$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 \
|
||||||
|
&& docker-php-source delete \
|
||||||
|
\
|
||||||
|
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps
|
||||||
|
|
||||||
|
COPY docker-php-ext-* /usr/local/bin/
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
COPY apache2-foreground /usr/local/bin/
|
||||||
|
WORKDIR /var/www/html
|
||||||
|
|
||||||
|
EXPOSE 80
|
||||||
|
CMD ["apache2-foreground"]
|
||||||
|
##</autogenerated>##
|
17
7.1/apache/apache2-foreground
Executable file
17
7.1/apache/apache2-foreground
Executable file
@ -0,0 +1,17 @@
|
|||||||
|
#!/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 <apache args>", 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_PID_FILE:=${APACHE_RUN_DIR:=/var/run/apache2}/apache2.pid}"
|
||||||
|
rm -f "$APACHE_PID_FILE"
|
||||||
|
|
||||||
|
exec apache2 -DFOREGROUND "$@"
|
51
7.1/apache/docker-php-ext-configure
Executable file
51
7.1/apache/docker-php-ext-configure
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
ext="$1"
|
||||||
|
extDir="/usr/src/php/ext/$ext"
|
||||||
|
if [ -z "$ext" ] || [ ! -d "$extDir" ]; then
|
||||||
|
echo >&2 "usage: $0 ext-name [configure flags]"
|
||||||
|
echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
|
||||||
|
echo >&2
|
||||||
|
echo >&2 'Possible values for ext-name:'
|
||||||
|
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
|
||||||
|
|
||||||
|
set -x
|
||||||
|
cd "$extDir"
|
||||||
|
phpize
|
||||||
|
./configure "$@"
|
83
7.1/apache/docker-php-ext-enable
Executable file
83
7.1/apache/docker-php-ext-enable
Executable file
@ -0,0 +1,83 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
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
|
113
7.1/apache/docker-php-ext-install
Executable file
113
7.1/apache/docker-php-ext-install
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
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
|
34
7.1/apache/docker-php-source
Executable file
34
7.1/apache/docker-php-source
Executable file
@ -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
|
51
7.1/docker-php-ext-configure
Executable file
51
7.1/docker-php-ext-configure
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
ext="$1"
|
||||||
|
extDir="/usr/src/php/ext/$ext"
|
||||||
|
if [ -z "$ext" ] || [ ! -d "$extDir" ]; then
|
||||||
|
echo >&2 "usage: $0 ext-name [configure flags]"
|
||||||
|
echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
|
||||||
|
echo >&2
|
||||||
|
echo >&2 'Possible values for ext-name:'
|
||||||
|
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
|
||||||
|
|
||||||
|
set -x
|
||||||
|
cd "$extDir"
|
||||||
|
phpize
|
||||||
|
./configure "$@"
|
83
7.1/docker-php-ext-enable
Executable file
83
7.1/docker-php-ext-enable
Executable file
@ -0,0 +1,83 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
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
|
113
7.1/docker-php-ext-install
Executable file
113
7.1/docker-php-ext-install
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
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
|
34
7.1/docker-php-source
Executable file
34
7.1/docker-php-source
Executable file
@ -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
|
137
7.1/fpm/Dockerfile
Normal file
137
7.1/fpm/Dockerfile
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
#
|
||||||
|
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
|
||||||
|
#
|
||||||
|
# PLEASE DO NOT EDIT IT DIRECTLY.
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM debian:jessie
|
||||||
|
|
||||||
|
# persistent / runtime deps
|
||||||
|
ENV PHPIZE_DEPS \
|
||||||
|
autoconf \
|
||||||
|
file \
|
||||||
|
g++ \
|
||||||
|
gcc \
|
||||||
|
libc-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
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
|
||||||
|
##</autogenerated>##
|
||||||
|
|
||||||
|
ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0
|
||||||
|
|
||||||
|
ENV PHP_VERSION 7.1.0RC1
|
||||||
|
ENV PHP_FILENAME php-7.1.0RC1.tar.xz
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& cd /usr/src \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME" -o php.tar.xz \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME.asc" -o php.tar.xz.asc \
|
||||||
|
&& 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 -r "$GNUPGHOME"
|
||||||
|
|
||||||
|
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 \
|
||||||
|
" \
|
||||||
|
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
|
||||||
|
\
|
||||||
|
&& docker-php-source extract \
|
||||||
|
&& cd /usr/src/php \
|
||||||
|
&& ./configure \
|
||||||
|
--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 \
|
||||||
|
\
|
||||||
|
$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 \
|
||||||
|
&& docker-php-source delete \
|
||||||
|
\
|
||||||
|
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps
|
||||||
|
|
||||||
|
COPY docker-php-ext-* /usr/local/bin/
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
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 don'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"]
|
||||||
|
##</autogenerated>##
|
153
7.1/fpm/alpine/Dockerfile
Normal file
153
7.1/fpm/alpine/Dockerfile
Normal file
@ -0,0 +1,153 @@
|
|||||||
|
#
|
||||||
|
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
|
||||||
|
#
|
||||||
|
# PLEASE DO NOT EDIT IT DIRECTLY.
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM alpine:3.4
|
||||||
|
|
||||||
|
# persistent / runtime deps
|
||||||
|
ENV PHPIZE_DEPS \
|
||||||
|
autoconf \
|
||||||
|
file \
|
||||||
|
g++ \
|
||||||
|
gcc \
|
||||||
|
libc-dev \
|
||||||
|
make \
|
||||||
|
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
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data
|
||||||
|
##</autogenerated>##
|
||||||
|
|
||||||
|
ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0
|
||||||
|
|
||||||
|
ENV PHP_VERSION 7.1.0RC1
|
||||||
|
ENV PHP_FILENAME php-7.1.0RC1.tar.xz
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& apk add --no-cache --virtual .fetch-deps \
|
||||||
|
gnupg \
|
||||||
|
&& mkdir -p /usr/src \
|
||||||
|
&& cd /usr/src \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME" -o php.tar.xz \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME.asc" -o php.tar.xz.asc \
|
||||||
|
&& 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 -r "$GNUPGHOME" \
|
||||||
|
&& apk del .fetch-deps
|
||||||
|
|
||||||
|
COPY docker-php-source /usr/local/bin/
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& apk add --no-cache --virtual .build-deps \
|
||||||
|
$PHPIZE_DEPS \
|
||||||
|
curl-dev \
|
||||||
|
libedit-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
openssl-dev \
|
||||||
|
sqlite-dev \
|
||||||
|
\
|
||||||
|
&& docker-php-source extract \
|
||||||
|
&& cd /usr/src/php \
|
||||||
|
&& ./configure \
|
||||||
|
--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 \
|
||||||
|
\
|
||||||
|
$PHP_EXTRA_CONFIGURE_ARGS \
|
||||||
|
&& make -j"$(getconf _NPROCESSORS_ONLN)" \
|
||||||
|
&& make install \
|
||||||
|
&& { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \
|
||||||
|
&& make clean \
|
||||||
|
&& 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
|
||||||
|
|
||||||
|
COPY docker-php-ext-* /usr/local/bin/
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
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 don'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"]
|
||||||
|
##</autogenerated>##
|
51
7.1/fpm/alpine/docker-php-ext-configure
Executable file
51
7.1/fpm/alpine/docker-php-ext-configure
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
ext="$1"
|
||||||
|
extDir="/usr/src/php/ext/$ext"
|
||||||
|
if [ -z "$ext" ] || [ ! -d "$extDir" ]; then
|
||||||
|
echo >&2 "usage: $0 ext-name [configure flags]"
|
||||||
|
echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
|
||||||
|
echo >&2
|
||||||
|
echo >&2 'Possible values for ext-name:'
|
||||||
|
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
|
||||||
|
|
||||||
|
set -x
|
||||||
|
cd "$extDir"
|
||||||
|
phpize
|
||||||
|
./configure "$@"
|
83
7.1/fpm/alpine/docker-php-ext-enable
Executable file
83
7.1/fpm/alpine/docker-php-ext-enable
Executable file
@ -0,0 +1,83 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
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
|
113
7.1/fpm/alpine/docker-php-ext-install
Executable file
113
7.1/fpm/alpine/docker-php-ext-install
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
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
|
34
7.1/fpm/alpine/docker-php-source
Executable file
34
7.1/fpm/alpine/docker-php-source
Executable file
@ -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
|
51
7.1/fpm/docker-php-ext-configure
Executable file
51
7.1/fpm/docker-php-ext-configure
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
ext="$1"
|
||||||
|
extDir="/usr/src/php/ext/$ext"
|
||||||
|
if [ -z "$ext" ] || [ ! -d "$extDir" ]; then
|
||||||
|
echo >&2 "usage: $0 ext-name [configure flags]"
|
||||||
|
echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
|
||||||
|
echo >&2
|
||||||
|
echo >&2 'Possible values for ext-name:'
|
||||||
|
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
|
||||||
|
|
||||||
|
set -x
|
||||||
|
cd "$extDir"
|
||||||
|
phpize
|
||||||
|
./configure "$@"
|
83
7.1/fpm/docker-php-ext-enable
Executable file
83
7.1/fpm/docker-php-ext-enable
Executable file
@ -0,0 +1,83 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
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
|
113
7.1/fpm/docker-php-ext-install
Executable file
113
7.1/fpm/docker-php-ext-install
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
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
|
34
7.1/fpm/docker-php-source
Executable file
34
7.1/fpm/docker-php-source
Executable file
@ -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
|
98
7.1/zts/Dockerfile
Normal file
98
7.1/zts/Dockerfile
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
#
|
||||||
|
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
|
||||||
|
#
|
||||||
|
# PLEASE DO NOT EDIT IT DIRECTLY.
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM debian:jessie
|
||||||
|
|
||||||
|
# persistent / runtime deps
|
||||||
|
ENV PHPIZE_DEPS \
|
||||||
|
autoconf \
|
||||||
|
file \
|
||||||
|
g++ \
|
||||||
|
gcc \
|
||||||
|
libc-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
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts
|
||||||
|
##</autogenerated>##
|
||||||
|
|
||||||
|
ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0
|
||||||
|
|
||||||
|
ENV PHP_VERSION 7.1.0RC1
|
||||||
|
ENV PHP_FILENAME php-7.1.0RC1.tar.xz
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& cd /usr/src \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME" -o php.tar.xz \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME.asc" -o php.tar.xz.asc \
|
||||||
|
&& 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 -r "$GNUPGHOME"
|
||||||
|
|
||||||
|
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 \
|
||||||
|
" \
|
||||||
|
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
|
||||||
|
\
|
||||||
|
&& docker-php-source extract \
|
||||||
|
&& cd /usr/src/php \
|
||||||
|
&& ./configure \
|
||||||
|
--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 \
|
||||||
|
\
|
||||||
|
$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 \
|
||||||
|
&& docker-php-source delete \
|
||||||
|
\
|
||||||
|
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false $buildDeps
|
||||||
|
|
||||||
|
COPY docker-php-ext-* /usr/local/bin/
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
CMD ["php", "-a"]
|
||||||
|
##</autogenerated>##
|
114
7.1/zts/alpine/Dockerfile
Normal file
114
7.1/zts/alpine/Dockerfile
Normal file
@ -0,0 +1,114 @@
|
|||||||
|
#
|
||||||
|
# NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh"
|
||||||
|
#
|
||||||
|
# PLEASE DO NOT EDIT IT DIRECTLY.
|
||||||
|
#
|
||||||
|
|
||||||
|
FROM alpine:3.4
|
||||||
|
|
||||||
|
# persistent / runtime deps
|
||||||
|
ENV PHPIZE_DEPS \
|
||||||
|
autoconf \
|
||||||
|
file \
|
||||||
|
g++ \
|
||||||
|
gcc \
|
||||||
|
libc-dev \
|
||||||
|
make \
|
||||||
|
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
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
ENV PHP_EXTRA_CONFIGURE_ARGS --enable-maintainer-zts
|
||||||
|
##</autogenerated>##
|
||||||
|
|
||||||
|
ENV GPG_KEYS A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0
|
||||||
|
|
||||||
|
ENV PHP_VERSION 7.1.0RC1
|
||||||
|
ENV PHP_FILENAME php-7.1.0RC1.tar.xz
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& apk add --no-cache --virtual .fetch-deps \
|
||||||
|
gnupg \
|
||||||
|
&& mkdir -p /usr/src \
|
||||||
|
&& cd /usr/src \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME" -o php.tar.xz \
|
||||||
|
&& curl -fSL "https://downloads.php.net/~davey/$PHP_FILENAME.asc" -o php.tar.xz.asc \
|
||||||
|
&& 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 -r "$GNUPGHOME" \
|
||||||
|
&& apk del .fetch-deps
|
||||||
|
|
||||||
|
COPY docker-php-source /usr/local/bin/
|
||||||
|
|
||||||
|
RUN set -xe \
|
||||||
|
&& apk add --no-cache --virtual .build-deps \
|
||||||
|
$PHPIZE_DEPS \
|
||||||
|
curl-dev \
|
||||||
|
libedit-dev \
|
||||||
|
libxml2-dev \
|
||||||
|
openssl-dev \
|
||||||
|
sqlite-dev \
|
||||||
|
\
|
||||||
|
&& docker-php-source extract \
|
||||||
|
&& cd /usr/src/php \
|
||||||
|
&& ./configure \
|
||||||
|
--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 \
|
||||||
|
\
|
||||||
|
$PHP_EXTRA_CONFIGURE_ARGS \
|
||||||
|
&& make -j"$(getconf _NPROCESSORS_ONLN)" \
|
||||||
|
&& make install \
|
||||||
|
&& { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \
|
||||||
|
&& make clean \
|
||||||
|
&& 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
|
||||||
|
|
||||||
|
COPY docker-php-ext-* /usr/local/bin/
|
||||||
|
|
||||||
|
##<autogenerated>##
|
||||||
|
CMD ["php", "-a"]
|
||||||
|
##</autogenerated>##
|
51
7.1/zts/alpine/docker-php-ext-configure
Executable file
51
7.1/zts/alpine/docker-php-ext-configure
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
ext="$1"
|
||||||
|
extDir="/usr/src/php/ext/$ext"
|
||||||
|
if [ -z "$ext" ] || [ ! -d "$extDir" ]; then
|
||||||
|
echo >&2 "usage: $0 ext-name [configure flags]"
|
||||||
|
echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
|
||||||
|
echo >&2
|
||||||
|
echo >&2 'Possible values for ext-name:'
|
||||||
|
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
|
||||||
|
|
||||||
|
set -x
|
||||||
|
cd "$extDir"
|
||||||
|
phpize
|
||||||
|
./configure "$@"
|
83
7.1/zts/alpine/docker-php-ext-enable
Executable file
83
7.1/zts/alpine/docker-php-ext-enable
Executable file
@ -0,0 +1,83 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
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
|
113
7.1/zts/alpine/docker-php-ext-install
Executable file
113
7.1/zts/alpine/docker-php-ext-install
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
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
|
34
7.1/zts/alpine/docker-php-source
Executable file
34
7.1/zts/alpine/docker-php-source
Executable file
@ -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
|
51
7.1/zts/docker-php-ext-configure
Executable file
51
7.1/zts/docker-php-ext-configure
Executable file
@ -0,0 +1,51 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
ext="$1"
|
||||||
|
extDir="/usr/src/php/ext/$ext"
|
||||||
|
if [ -z "$ext" ] || [ ! -d "$extDir" ]; then
|
||||||
|
echo >&2 "usage: $0 ext-name [configure flags]"
|
||||||
|
echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
|
||||||
|
echo >&2
|
||||||
|
echo >&2 'Possible values for ext-name:'
|
||||||
|
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
|
||||||
|
|
||||||
|
set -x
|
||||||
|
cd "$extDir"
|
||||||
|
phpize
|
||||||
|
./configure "$@"
|
83
7.1/zts/docker-php-ext-enable
Executable file
83
7.1/zts/docker-php-ext-enable
Executable file
@ -0,0 +1,83 @@
|
|||||||
|
#!/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
|
||||||
|
|
||||||
|
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
|
113
7.1/zts/docker-php-ext-install
Executable file
113
7.1/zts/docker-php-ext-install
Executable file
@ -0,0 +1,113 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
set -e
|
||||||
|
|
||||||
|
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
|
||||||
|
|
||||||
|
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
|
||||||
|
)
|
||||||
|
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
|
34
7.1/zts/docker-php-source
Executable file
34
7.1/zts/docker-php-source
Executable file
@ -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
|
@ -2,6 +2,10 @@
|
|||||||
set -e
|
set -e
|
||||||
|
|
||||||
declare -A gpgKeys=(
|
declare -A gpgKeys=(
|
||||||
|
# https://wiki.php.net/todo/php71
|
||||||
|
# davey
|
||||||
|
[7.1]='A917B1ECDA84AEC2B568FED6F50ABC807BD5DCD0'
|
||||||
|
|
||||||
# https://wiki.php.net/todo/php70
|
# https://wiki.php.net/todo/php70
|
||||||
# ab
|
# ab
|
||||||
[7.0]='1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763'
|
[7.0]='1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763'
|
||||||
|
Reference in New Issue
Block a user