Add php-7.0.0alpha2 (Issue #108)

Adding 7.0 to travis

Fixes for the reviewed code

Fixes to have the directory as 7.0

Change version on travis

Remove GPG from Dockerfile on 7.0
This commit is contained in:
Marcelo Andrade 2015-06-29 23:34:47 +00:00 committed by Tianon Gravi
parent d0b37892f4
commit 11f5f37233
14 changed files with 542 additions and 3 deletions

View File

@ -4,6 +4,9 @@ language: bash
dist: trusty
env:
- VERSION=7.0 VARIANT=
- VERSION=7.0 VARIANT=apache
- VERSION=7.0 VARIANT=fpm
- VERSION=5.6 VARIANT=
- VERSION=5.6 VARIANT=apache
- VERSION=5.6 VARIANT=fpm

58
7.0/Dockerfile Normal file
View File

@ -0,0 +1,58 @@
FROM debian:jessie
# persistent / runtime deps
RUN apt-get update && apt-get install -y ca-certificates curl libpcre3 librecode0 libsqlite3-0 libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
# phpize deps
RUN apt-get update && apt-get install -y autoconf file g++ gcc libc-dev make pkg-config re2c --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 PHP_VERSION 7.0.0alpha2
# --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself)
RUN buildDeps=" \
$PHP_EXTRA_BUILD_DEPS \
libcurl4-openssl-dev \
libpcre3-dev \
libreadline6-dev \
librecode-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
xz-utils \
" \
&& set -x \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& curl -SL "https://downloads.php.net/~ab/php-$PHP_VERSION.tar.xz" -o php.tar.xz \
&& mkdir -p /usr/src/php \
&& tar -xof php.tar.xz -C /usr/src/php --strip-components=1 \
&& rm php.tar.xz* \
&& cd /usr/src/php \
&& ./configure \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
$PHP_EXTRA_CONFIGURE_ARGS \
--disable-cgi \
--enable-mysqlnd \
--with-curl \
--with-openssl \
--with-pcre \
--with-readline \
--with-recode \
--with-zlib \
&& make -j"$(nproc)" \
&& make install \
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \
&& make clean
COPY docker-php-ext-* /usr/local/bin/
##<autogenerated>##
CMD ["php", "-a"]
##</autogenerated>##

75
7.0/apache/Dockerfile Normal file
View File

@ -0,0 +1,75 @@
FROM debian:jessie
# persistent / runtime deps
RUN apt-get update && apt-get install -y ca-certificates curl libpcre3 librecode0 libsqlite3-0 libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
# phpize deps
RUN apt-get update && apt-get install -y autoconf file g++ gcc libc-dev make pkg-config re2c --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/*
RUN rm -rf /var/www/html && mkdir -p /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html && chown -R www-data:www-data /var/lock/apache2 /var/run/apache2 /var/log/apache2 /var/www/html
# Apache + PHP requires preforking Apache for best results
RUN a2dismod mpm_event && a2enmod mpm_prefork
RUN mv /etc/apache2/apache2.conf /etc/apache2/apache2.conf.dist && rm /etc/apache2/conf-enabled/* /etc/apache2/sites-enabled/*
COPY apache2.conf /etc/apache2/apache2.conf
# it'd be nice if we could not COPY apache2.conf until the end of the Dockerfile, but its contents are checked by PHP during compilation
ENV PHP_EXTRA_BUILD_DEPS apache2-dev
ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2
##</autogenerated>##
ENV PHP_VERSION 7.0.0alpha2
# --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself)
RUN buildDeps=" \
$PHP_EXTRA_BUILD_DEPS \
libcurl4-openssl-dev \
libpcre3-dev \
libreadline6-dev \
librecode-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
xz-utils \
" \
&& set -x \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& curl -SL "https://downloads.php.net/~ab/php-$PHP_VERSION.tar.xz" -o php.tar.xz \
&& mkdir -p /usr/src/php \
&& tar -xof php.tar.xz -C /usr/src/php --strip-components=1 \
&& rm php.tar.xz* \
&& cd /usr/src/php \
&& ./configure \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
$PHP_EXTRA_CONFIGURE_ARGS \
--disable-cgi \
--enable-mysqlnd \
--with-curl \
--with-openssl \
--with-pcre \
--with-readline \
--with-recode \
--with-zlib \
&& make -j"$(nproc)" \
&& make install \
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \
&& make clean
COPY docker-php-ext-* /usr/local/bin/
##<autogenerated>##
COPY apache2-foreground /usr/local/bin/
WORKDIR /var/www/html
EXPOSE 80
CMD ["apache2-foreground"]
##</autogenerated>##

7
7.0/apache/apache2-foreground Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -e
# Apache gets grumpy about PID files pre-existing
rm -f /var/run/apache2/apache2.pid
exec apache2 -DFOREGROUND

64
7.0/apache/apache2.conf Normal file
View File

@ -0,0 +1,64 @@
# see http://sources.debian.net/src/apache2/2.4.10-1/debian/config-dir/apache2.conf
Mutex file:/var/lock/apache2 default
PidFile /var/run/apache2/apache2.pid
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
User www-data
Group www-data
HostnameLookups Off
ErrorLog /proc/self/fd/2
LogLevel warn
IncludeOptional mods-enabled/*.load
IncludeOptional mods-enabled/*.conf
# ports.conf
Listen 80
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /var/www/>
AllowOverride All
Require all granted
</Directory>
DocumentRoot /var/www/html
AccessFileName .htaccess
<FilesMatch "^\.ht">
Require all denied
</FilesMatch>
LogFormat "%v:%p %h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" vhost_combined
LogFormat "%h %l %u %t \"%r\" %>s %O \"%{Referer}i\" \"%{User-Agent}i\"" combined
LogFormat "%h %l %u %t \"%r\" %>s %O" common
LogFormat "%{Referer}i -> %U" referer
LogFormat "%{User-agent}i" agent
CustomLog /proc/self/fd/1 combined
<FilesMatch \.php$>
SetHandler application/x-httpd-php
</FilesMatch>
# Multiple DirectoryIndex directives within the same context will add
# to the list of resources to look for rather than replace
# https://httpd.apache.org/docs/current/mod/mod_dir.html#directoryindex
DirectoryIndex disabled
DirectoryIndex index.php index.html
IncludeOptional conf-enabled/*.conf
IncludeOptional sites-enabled/*.conf

View File

@ -0,0 +1,19 @@
#!/bin/bash
set -e
ext="$1"
extDir="/usr/src/php/ext/$ext"
if [ -z "$ext" -o ! -d "$extDir" ]; then
echo >&2 "usage: $0 ext-name [configure flags]"
echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
echo >&2
echo >&2 'Possible values for ext-name:'
echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
exit 1
fi
shift
set -x
cd "$extDir"
phpize
./configure "$@"

View File

@ -0,0 +1,60 @@
#!/bin/bash
set -e
cd /usr/src/php/ext
usage() {
echo "usage: $0 ext-name [ext-name ...]"
echo " ie: $0 gd mysqli"
echo " $0 pdo pdo_mysql"
echo
echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure'
echo
echo 'Possible values for ext-name:'
echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
}
exts=()
while [ $# -gt 0 ]; do
ext="$1"
shift
if [ -z "$ext" ]; then
continue
fi
if [ ! -d "$ext" ]; then
echo >&2 "error: $(pwd -P)/$ext does not exist"
echo >&2
usage >&2
exit 1
fi
exts+=( "$ext" )
done
if [ "${#exts[@]}" -eq 0 ]; then
usage >&2
exit 1
fi
for ext in "${exts[@]}"; do
(
cd "$ext"
[ -e Makefile ] || docker-php-ext-configure "$ext"
make
make install
ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini"
for module in modules/*.so; do
if [ -f "$module" ]; then
if grep -q zend_extension_entry "$module"; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(basename "$module")"
else
line="extension=$(basename "$module")"
fi
if ! grep -q "$line" "$ini" 2>/dev/null; then
echo "$line" >> "$ini"
fi
fi
done
make clean
)
done

19
7.0/docker-php-ext-configure Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
set -e
ext="$1"
extDir="/usr/src/php/ext/$ext"
if [ -z "$ext" -o ! -d "$extDir" ]; then
echo >&2 "usage: $0 ext-name [configure flags]"
echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
echo >&2
echo >&2 'Possible values for ext-name:'
echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
exit 1
fi
shift
set -x
cd "$extDir"
phpize
./configure "$@"

60
7.0/docker-php-ext-install Executable file
View File

@ -0,0 +1,60 @@
#!/bin/bash
set -e
cd /usr/src/php/ext
usage() {
echo "usage: $0 ext-name [ext-name ...]"
echo " ie: $0 gd mysqli"
echo " $0 pdo pdo_mysql"
echo
echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure'
echo
echo 'Possible values for ext-name:'
echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
}
exts=()
while [ $# -gt 0 ]; do
ext="$1"
shift
if [ -z "$ext" ]; then
continue
fi
if [ ! -d "$ext" ]; then
echo >&2 "error: $(pwd -P)/$ext does not exist"
echo >&2
usage >&2
exit 1
fi
exts+=( "$ext" )
done
if [ "${#exts[@]}" -eq 0 ]; then
usage >&2
exit 1
fi
for ext in "${exts[@]}"; do
(
cd "$ext"
[ -e Makefile ] || docker-php-ext-configure "$ext"
make
make install
ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini"
for module in modules/*.so; do
if [ -f "$module" ]; then
if grep -q zend_extension_entry "$module"; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(basename "$module")"
else
line="extension=$(basename "$module")"
fi
if ! grep -q "$line" "$ini" 2>/dev/null; then
echo "$line" >> "$ini"
fi
fi
done
make clean
)
done

63
7.0/fpm/Dockerfile Normal file
View File

@ -0,0 +1,63 @@
FROM debian:jessie
# persistent / runtime deps
RUN apt-get update && apt-get install -y ca-certificates curl libpcre3 librecode0 libsqlite3-0 libxml2 --no-install-recommends && rm -r /var/lib/apt/lists/*
# phpize deps
RUN apt-get update && apt-get install -y autoconf file g++ gcc libc-dev make pkg-config re2c --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 PHP_VERSION 7.0.0alpha2
# --enable-mysqlnd is included below because it's harder to compile after the fact the extensions are (since it's a plugin for several extensions, not an extension in itself)
RUN buildDeps=" \
$PHP_EXTRA_BUILD_DEPS \
libcurl4-openssl-dev \
libpcre3-dev \
libreadline6-dev \
librecode-dev \
libsqlite3-dev \
libssl-dev \
libxml2-dev \
xz-utils \
" \
&& set -x \
&& apt-get update && apt-get install -y $buildDeps --no-install-recommends && rm -rf /var/lib/apt/lists/* \
&& curl -SL "https://downloads.php.net/~ab/php-$PHP_VERSION.tar.xz" -o php.tar.xz \
&& mkdir -p /usr/src/php \
&& tar -xof php.tar.xz -C /usr/src/php --strip-components=1 \
&& rm php.tar.xz* \
&& cd /usr/src/php \
&& ./configure \
--with-config-file-path="$PHP_INI_DIR" \
--with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \
$PHP_EXTRA_CONFIGURE_ARGS \
--disable-cgi \
--enable-mysqlnd \
--with-curl \
--with-openssl \
--with-pcre \
--with-readline \
--with-recode \
--with-zlib \
&& make -j"$(nproc)" \
&& make install \
&& { find /usr/local/bin /usr/local/sbin -type f -executable -exec strip --strip-all '{}' + || true; } \
&& apt-get purge -y --auto-remove -o APT::AutoRemove::RecommendsImportant=false -o APT::AutoRemove::SuggestsImportant=false $buildDeps \
&& make clean
COPY docker-php-ext-* /usr/local/bin/
##<autogenerated>##
WORKDIR /var/www/html
COPY php-fpm.conf /usr/local/etc/
EXPOSE 9000
CMD ["php-fpm"]
##</autogenerated>##

View File

@ -0,0 +1,19 @@
#!/bin/bash
set -e
ext="$1"
extDir="/usr/src/php/ext/$ext"
if [ -z "$ext" -o ! -d "$extDir" ]; then
echo >&2 "usage: $0 ext-name [configure flags]"
echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something"
echo >&2
echo >&2 'Possible values for ext-name:'
echo >&2 $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
exit 1
fi
shift
set -x
cd "$extDir"
phpize
./configure "$@"

60
7.0/fpm/docker-php-ext-install Executable file
View File

@ -0,0 +1,60 @@
#!/bin/bash
set -e
cd /usr/src/php/ext
usage() {
echo "usage: $0 ext-name [ext-name ...]"
echo " ie: $0 gd mysqli"
echo " $0 pdo pdo_mysql"
echo
echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure'
echo
echo 'Possible values for ext-name:'
echo $(find /usr/src/php/ext -mindepth 2 -maxdepth 2 -type f -name 'config.m4' | cut -d/ -f6 | sort)
}
exts=()
while [ $# -gt 0 ]; do
ext="$1"
shift
if [ -z "$ext" ]; then
continue
fi
if [ ! -d "$ext" ]; then
echo >&2 "error: $(pwd -P)/$ext does not exist"
echo >&2
usage >&2
exit 1
fi
exts+=( "$ext" )
done
if [ "${#exts[@]}" -eq 0 ]; then
usage >&2
exit 1
fi
for ext in "${exts[@]}"; do
(
cd "$ext"
[ -e Makefile ] || docker-php-ext-configure "$ext"
make
make install
ini="/usr/local/etc/php/conf.d/docker-php-ext-$ext.ini"
for module in modules/*.so; do
if [ -f "$module" ]; then
if grep -q zend_extension_entry "$module"; then
# https://wiki.php.net/internals/extensions#loading_zend_extensions
line="zend_extension=$(basename "$module")"
else
line="extension=$(basename "$module")"
fi
if ! grep -q "$line" "$ini" 2>/dev/null; then
echo "$line" >> "$ini"
fi
fi
done
make clean
)
done

25
7.0/fpm/php-fpm.conf Normal file
View File

@ -0,0 +1,25 @@
; This file was initially adapated from the output of: (on PHP 5.6)
; grep -vE '^;|^ *$' /usr/local/etc/php-fpm.conf.default
[global]
error_log = /proc/self/fd/2
daemonize = no
[www]
; if we send this to /proc/self/fd/1, it never appears
access.log = /proc/self/fd/2
user = www-data
group = www-data
listen = [::]:9000
pm = dynamic
pm.max_children = 5
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
clear_env = no

View File

@ -3,13 +3,15 @@ set -e
declare -A gpgKeys
gpgKeys=(
[7.0]='1A4E8B7277C42E53DBA9C7B9BCAA30EA9C0D5763'
[5.6]='6E4F6AB321FDC07F2C332E3AC2BF0BC433CFC8B3 0BD78B5F97500D450838F95DFE857D9A90D90EC1'
[5.5]='0BD78B5F97500D450838F95DFE857D9A90D90EC1 0B96609E270F565C13292B24C13C70B87267B52D'
[5.4]='F38252826ACD957EF380D39F2F7956BC5DA04B5D'
[5.3]='0B96609E270F565C13292B24C13C70B87267B52D 0A95E9A026542D53835E3F3A7DEC4E69FC9C83D7'
)
# see http://php.net/downloads.php
alphaVersion="7.0"
fullAlphaVersion="7.0.0alpha2"
cd "$(dirname "$(readlink -f "$BASH_SOURCE")")"
versions=( "$@" )
@ -32,7 +34,12 @@ for version in "${versions[@]}"; do
done
if [ -z "$fullVersion" ]; then
echo >&2 "ERROR: missing $version in $packagesUrl"
continue
# if version is alpha then we add the missing part
if [ "$alphaVersion" == "$version" ]; then
fullVersion="$fullAlphaVersion"
else
continue
fi
fi
gpgKey="${gpgKeys[$version]}"
@ -41,7 +48,7 @@ for version in "${versions[@]}"; do
echo >&2 " try looking on http://php.net/downloads.php#gpg-$version"
exit 1
fi
( set -x; cp docker-php-ext-* "$version/" )
for variant in apache fpm; do