├── docker-php-entrypoint ├── apache ├── docker-php-entrypoint ├── docker-php-source ├── envvars ├── docker-php-ext-configure ├── apache2-foreground ├── docker-php-ext-enable ├── docker-php-ext-install ├── Dockerfile └── httpd.conf ├── fpm ├── docker-php-entrypoint ├── docker-php-source ├── docker-php-ext-configure ├── docker-php-ext-enable ├── docker-php-ext-install └── Dockerfile ├── vendor └── bin │ ├── php │ └── php-server ├── docker-php-source ├── docker-php-ext-configure ├── with-modules ├── Dockerfile.tpl ├── fpm │ └── Dockerfile.tpl └── apache │ └── Dockerfile.tpl ├── docker-php-ext-enable ├── README.md ├── docker-php-ext-install ├── .travis.yml └── Dockerfile /docker-php-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # first arg is `-f` or `--some-option` 5 | if [ "${1#-}" != "$1" ]; then 6 | set -- php "$@" 7 | fi 8 | 9 | exec "$@" 10 | -------------------------------------------------------------------------------- /apache/docker-php-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # first arg is `-f` or `--some-option` 5 | if [ "${1#-}" != "$1" ]; then 6 | set -- php "$@" 7 | fi 8 | 9 | exec "$@" 10 | -------------------------------------------------------------------------------- /fpm/docker-php-entrypoint: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # first arg is `-f` or `--some-option` 5 | if [ "${1#-}" != "$1" ]; then 6 | set -- php-fpm "$@" 7 | fi 8 | 9 | exec "$@" 10 | -------------------------------------------------------------------------------- /vendor/bin/php: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | PHP_CLI_DOCKER_IMAGE=${PHP_CLI_DOCKER_IMAGE:-'cespi/php-5.3:modules-apache-latest'} 6 | PHP_OPTIONS=${PHP_OPTIONS:- -d 'date.timezone=America/Argentina/Buenos_Aires' -d memory_limit=512M} 7 | PHP_CLI_DOCKER_RUN_OPTIONS=${PHP_CLI_DOCKER_RUN_OPTIONS:-'--add-host local.docker:172.17.0.1'} 8 | 9 | docker run --rm -it -u `id -u $USER`:`id -g $USER` -v "`pwd`:`pwd`" -w "`pwd`" $PHP_CLI_DOCKER_RUN_OPTIONS $PHP_CLI_DOCKER_IMAGE $PHP_OPTIONS $@ 10 | -------------------------------------------------------------------------------- /docker-php-source: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | dir=/usr/src/php 5 | 6 | usage() { 7 | echo "usage: $0 COMMAND" 8 | echo 9 | echo "Manage php source tarball lifecycle." 10 | echo 11 | echo "Commands:" 12 | echo " extract extract php source tarball into directory $dir if not already done." 13 | echo " delete delete extracted php source located into $dir if not already done." 14 | echo 15 | } 16 | 17 | case "$1" in 18 | extract) 19 | mkdir -p "$dir" 20 | if [ ! -f "$dir/.docker-extracted" ]; then 21 | tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 22 | touch "$dir/.docker-extracted" 23 | fi 24 | ;; 25 | 26 | delete) 27 | rm -rf "$dir" 28 | ;; 29 | 30 | *) 31 | usage 32 | exit 1 33 | ;; 34 | esac 35 | -------------------------------------------------------------------------------- /apache/docker-php-source: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | dir=/usr/src/php 5 | 6 | usage() { 7 | echo "usage: $0 COMMAND" 8 | echo 9 | echo "Manage php source tarball lifecycle." 10 | echo 11 | echo "Commands:" 12 | echo " extract extract php source tarball into directory $dir if not already done." 13 | echo " delete delete extracted php source located into $dir if not already done." 14 | echo 15 | } 16 | 17 | case "$1" in 18 | extract) 19 | mkdir -p "$dir" 20 | if [ ! -f "$dir/.docker-extracted" ]; then 21 | tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 22 | touch "$dir/.docker-extracted" 23 | fi 24 | ;; 25 | 26 | delete) 27 | rm -rf "$dir" 28 | ;; 29 | 30 | *) 31 | usage 32 | exit 1 33 | ;; 34 | esac 35 | -------------------------------------------------------------------------------- /fpm/docker-php-source: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | dir=/usr/src/php 5 | 6 | usage() { 7 | echo "usage: $0 COMMAND" 8 | echo 9 | echo "Manage php source tarball lifecycle." 10 | echo 11 | echo "Commands:" 12 | echo " extract extract php source tarball into directory $dir if not already done." 13 | echo " delete delete extracted php source located into $dir if not already done." 14 | echo 15 | } 16 | 17 | case "$1" in 18 | extract) 19 | mkdir -p "$dir" 20 | if [ ! -f "$dir/.docker-extracted" ]; then 21 | tar -Jxf /usr/src/php.tar.xz -C "$dir" --strip-components=1 22 | touch "$dir/.docker-extracted" 23 | fi 24 | ;; 25 | 26 | delete) 27 | rm -rf "$dir" 28 | ;; 29 | 30 | *) 31 | usage 32 | exit 1 33 | ;; 34 | esac 35 | -------------------------------------------------------------------------------- /apache/envvars: -------------------------------------------------------------------------------- 1 | unset HOME 2 | 3 | if [ "${APACHE_CONFDIR##/etc/apache2-}" != "${APACHE_CONFDIR}" ] ; then 4 | SUFFIX="-${APACHE_CONFDIR##/etc/apache2-}" 5 | else 6 | SUFFIX= 7 | fi 8 | 9 | : ${APACHE_DOCUMENT_ROOT:=/var/www/html} 10 | export APACHE_DOCUMENT_ROOT 11 | : ${APACHE_RUN_USER:=apache} 12 | export APACHE_RUN_USER 13 | : ${APACHE_RUN_GROUP:=apache} 14 | export APACHE_RUN_GROUP 15 | : ${APACHE_PID_FILE:=/run/apache2/apache2$SUFFIX.pid} 16 | export APACHE_PID_FILE 17 | : ${APACHE_RUN_DIR:=/run/apache2$SUFFIX} 18 | export APACHE_RUN_DIR 19 | : ${APACHE_LOCK_DIR:=/var/lock/apache2$SUFFIX} 20 | export APACHE_LOCK_DIR 21 | : ${APACHE_LOG_DIR:=/var/log/apache2$SUFFIX} 22 | export APACHE_LOG_DIR 23 | 24 | : ${LANG:=C} 25 | export LANG 26 | 27 | export LANG 28 | 29 | -------------------------------------------------------------------------------- /vendor/bin/php-server: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | set -e 4 | 5 | 6 | PHP_SERVER_PORT=$1 7 | 8 | [ -z "$PHP_SERVER_PORT" ] && ( echo You must specify wich port to use as parameter; exit 1) 9 | 10 | #if $1 was set, the remove it 11 | shift 12 | 13 | [ "$PHP_SERVER_PORT" -lt 1024 ] && (echo port must be greater than 1024; exit 1) 14 | 15 | PHP_SERVER_DOCKER_IMAGE=${PHP_SERVER_DOCKER_IMAGE:-'cespi/php-5.3:modules-apache-latest'} 16 | PHP_SERVER_LOCAL_PHP_INI=${PHP_SERVER_LOCAL_PHP_INI:-"$HOME/bin/etc/docker/php/php.ini"} 17 | [ -f "${PHP_SERVER_LOCAL_PHP_INI}" ] || ( echo "Variable PHP_SERVER_LOCAL_PHP_INI must be set with a valid php ini file. It now points to $PHP_SERVER_LOCAL_PHP_INI, but file seems to not exist" && exit 1 ) 18 | PHP_SERVER_DOCKER_RUN_OPTIONS=${PHP_SERVER_DOCKER_RUN_OPTIONS:-"--add-host local.docker:172.17.0.1 -e APACHE_RUN_USER=$USER -e APACHE_RUN_GROUP=`id -ng $USER` -v $PHP_SERVER_LOCAL_PHP_INI:/usr/local/etc/php/conf.d/custom.ini:ro"} 19 | 20 | docker run --rm -p ${PHP_SERVER_PORT}:80 -v /etc/passwd:/etc/passwd:ro -v /etc/group:/etc/group:ro -v "`pwd`:`pwd`" -e "APACHE_DOCUMENT_ROOT=`pwd`" -w "`pwd`" $PHP_SERVER_DOCKER_RUN_OPTIONS $PHP_SERVER_DOCKER_IMAGE $@ 21 | 22 | -------------------------------------------------------------------------------- /docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # prefer user supplied CFLAGS, but default to our PHP_CFLAGS 5 | : ${CFLAGS:=$PHP_CFLAGS} 6 | : ${CPPFLAGS:=$PHP_CPPFLAGS} 7 | : ${LDFLAGS:=$PHP_LDFLAGS} 8 | export CFLAGS CPPFLAGS LDFLAGS 9 | 10 | srcExists= 11 | if [ -d /usr/src/php ]; then 12 | srcExists=1 13 | fi 14 | docker-php-source extract 15 | if [ -z "$srcExists" ]; then 16 | touch /usr/src/php/.docker-delete-me 17 | fi 18 | 19 | cd /usr/src/php/ext 20 | 21 | ext="$1" 22 | if [ -z "$ext" ] || [ ! -d "$ext" ]; then 23 | echo >&2 "usage: $0 ext-name [configure flags]" 24 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 25 | echo >&2 26 | echo >&2 'Possible values for ext-name:' 27 | find /usr/src/php/ext \ 28 | -mindepth 2 \ 29 | -maxdepth 2 \ 30 | -type f \ 31 | -name 'config.m4' \ 32 | | xargs -n1 dirname \ 33 | | xargs -n1 basename \ 34 | | sort \ 35 | | xargs 36 | exit 1 37 | fi 38 | shift 39 | 40 | pm='unknown' 41 | if [ -e /lib/apk/db/installed ]; then 42 | pm='apk' 43 | fi 44 | 45 | if [ "$pm" = 'apk' ]; then 46 | if \ 47 | [ -n "$PHPIZE_DEPS" ] \ 48 | && ! apk info --installed .phpize-deps > /dev/null \ 49 | && ! apk info --installed .phpize-deps-configure > /dev/null \ 50 | ; then 51 | apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS 52 | fi 53 | fi 54 | 55 | set -x 56 | cd "$ext" 57 | phpize 58 | ./configure "$@" 59 | -------------------------------------------------------------------------------- /apache/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # prefer user supplied CFLAGS, but default to our PHP_CFLAGS 5 | : ${CFLAGS:=$PHP_CFLAGS} 6 | : ${CPPFLAGS:=$PHP_CPPFLAGS} 7 | : ${LDFLAGS:=$PHP_LDFLAGS} 8 | export CFLAGS CPPFLAGS LDFLAGS 9 | 10 | srcExists= 11 | if [ -d /usr/src/php ]; then 12 | srcExists=1 13 | fi 14 | docker-php-source extract 15 | if [ -z "$srcExists" ]; then 16 | touch /usr/src/php/.docker-delete-me 17 | fi 18 | 19 | cd /usr/src/php/ext 20 | 21 | ext="$1" 22 | if [ -z "$ext" ] || [ ! -d "$ext" ]; then 23 | echo >&2 "usage: $0 ext-name [configure flags]" 24 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 25 | echo >&2 26 | echo >&2 'Possible values for ext-name:' 27 | find /usr/src/php/ext \ 28 | -mindepth 2 \ 29 | -maxdepth 2 \ 30 | -type f \ 31 | -name 'config.m4' \ 32 | | xargs -n1 dirname \ 33 | | xargs -n1 basename \ 34 | | sort \ 35 | | xargs 36 | exit 1 37 | fi 38 | shift 39 | 40 | pm='unknown' 41 | if [ -e /lib/apk/db/installed ]; then 42 | pm='apk' 43 | fi 44 | 45 | if [ "$pm" = 'apk' ]; then 46 | if \ 47 | [ -n "$PHPIZE_DEPS" ] \ 48 | && ! apk info --installed .phpize-deps > /dev/null \ 49 | && ! apk info --installed .phpize-deps-configure > /dev/null \ 50 | ; then 51 | apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS 52 | fi 53 | fi 54 | 55 | set -x 56 | cd "$ext" 57 | phpize 58 | ./configure "$@" 59 | -------------------------------------------------------------------------------- /fpm/docker-php-ext-configure: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # prefer user supplied CFLAGS, but default to our PHP_CFLAGS 5 | : ${CFLAGS:=$PHP_CFLAGS} 6 | : ${CPPFLAGS:=$PHP_CPPFLAGS} 7 | : ${LDFLAGS:=$PHP_LDFLAGS} 8 | export CFLAGS CPPFLAGS LDFLAGS 9 | 10 | srcExists= 11 | if [ -d /usr/src/php ]; then 12 | srcExists=1 13 | fi 14 | docker-php-source extract 15 | if [ -z "$srcExists" ]; then 16 | touch /usr/src/php/.docker-delete-me 17 | fi 18 | 19 | cd /usr/src/php/ext 20 | 21 | ext="$1" 22 | if [ -z "$ext" ] || [ ! -d "$ext" ]; then 23 | echo >&2 "usage: $0 ext-name [configure flags]" 24 | echo >&2 " ie: $0 gd --with-jpeg-dir=/usr/local/something" 25 | echo >&2 26 | echo >&2 'Possible values for ext-name:' 27 | find /usr/src/php/ext \ 28 | -mindepth 2 \ 29 | -maxdepth 2 \ 30 | -type f \ 31 | -name 'config.m4' \ 32 | | xargs -n1 dirname \ 33 | | xargs -n1 basename \ 34 | | sort \ 35 | | xargs 36 | exit 1 37 | fi 38 | shift 39 | 40 | pm='unknown' 41 | if [ -e /lib/apk/db/installed ]; then 42 | pm='apk' 43 | fi 44 | 45 | if [ "$pm" = 'apk' ]; then 46 | if \ 47 | [ -n "$PHPIZE_DEPS" ] \ 48 | && ! apk info --installed .phpize-deps > /dev/null \ 49 | && ! apk info --installed .phpize-deps-configure > /dev/null \ 50 | ; then 51 | apk add --no-cache --virtual .phpize-deps-configure $PHPIZE_DEPS 52 | fi 53 | fi 54 | 55 | set -x 56 | cd "$ext" 57 | phpize 58 | ./configure "$@" 59 | -------------------------------------------------------------------------------- /with-modules/Dockerfile.tpl: -------------------------------------------------------------------------------- 1 | FROM cespi/php-5.3:cli-$TAG 2 | 3 | 4 | RUN apk add -U --no-cache \ 5 | autoconf \ 6 | libmemcached-dev \ 7 | libxml2-dev \ 8 | alpine-sdk \ 9 | mariadb-dev \ 10 | zlib-dev \ 11 | libxslt-dev \ 12 | openldap-dev \ 13 | libjpeg-turbo-dev \ 14 | libmcrypt-dev \ 15 | freetype-dev \ 16 | libpng-dev \ 17 | && pecl install apc \ 18 | && echo extension=apc.so > /usr/local/etc/php/conf.d/apc.ini \ 19 | && pecl install memcached-2.2.0 \ 20 | && echo extension=memcached.so > /usr/local/etc/php/conf.d/memcached.ini \ 21 | && pecl install memcache-2.2.7 \ 22 | && echo extension=memcache.so > /usr/local/etc/php/conf.d/memcache.ini \ 23 | && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr/include --with-freetype-dir=/usr/include \ 24 | && docker-php-ext-install gd \ 25 | && docker-php-ext-configure ldap --with-libdir=lib/ \ 26 | && docker-php-ext-install mysql \ 27 | && docker-php-ext-install ldap \ 28 | && docker-php-ext-install bcmath \ 29 | && docker-php-ext-install soap \ 30 | && docker-php-ext-install xsl \ 31 | && docker-php-ext-install mcrypt \ 32 | && docker-php-ext-install mbstring pdo pdo_mysql zip \ 33 | && apk del --purge autoconf alpine-sdk mariadb-dev openldap-dev \ 34 | && apk add -U mariadb-client-libs libldap \ 35 | && cd /usr/local/bin \ 36 | && curl -sS https://getcomposer.org/installer | php \ 37 | && mv composer.phar composer \ 38 | && rm -rf /var/cache/apk/* 39 | -------------------------------------------------------------------------------- /with-modules/fpm/Dockerfile.tpl: -------------------------------------------------------------------------------- 1 | FROM cespi/php-5.3:fpm-$TAG 2 | 3 | 4 | RUN apk add -U --no-cache \ 5 | autoconf \ 6 | libmemcached-dev \ 7 | libxml2-dev \ 8 | alpine-sdk \ 9 | mariadb-dev \ 10 | zlib-dev \ 11 | libxslt-dev \ 12 | openldap-dev \ 13 | libjpeg-turbo-dev \ 14 | libmcrypt-dev \ 15 | freetype-dev \ 16 | libpng-dev \ 17 | && pecl install apc \ 18 | && echo extension=apc.so > /usr/local/etc/php/conf.d/apc.ini \ 19 | && pecl install memcached-2.2.0 \ 20 | && echo extension=memcached.so > /usr/local/etc/php/conf.d/memcached.ini \ 21 | && pecl install memcache-2.2.7 \ 22 | && echo extension=memcache.so > /usr/local/etc/php/conf.d/memcache.ini \ 23 | && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr/include --with-freetype-dir=/usr/include \ 24 | && docker-php-ext-install gd \ 25 | && docker-php-ext-configure ldap --with-libdir=lib/ \ 26 | && docker-php-ext-install mysql \ 27 | && docker-php-ext-install ldap \ 28 | && docker-php-ext-install bcmath \ 29 | && docker-php-ext-install soap \ 30 | && docker-php-ext-install xsl \ 31 | && docker-php-ext-install mcrypt \ 32 | && docker-php-ext-install mbstring pdo pdo_mysql zip \ 33 | && apk del --purge autoconf alpine-sdk mariadb-dev openldap-dev \ 34 | && apk add -U mariadb-client-libs libldap \ 35 | && cd /usr/local/bin \ 36 | && curl -sS https://getcomposer.org/installer | php \ 37 | && mv composer.phar composer \ 38 | && rm -rf /var/cache/apk/* 39 | -------------------------------------------------------------------------------- /with-modules/apache/Dockerfile.tpl: -------------------------------------------------------------------------------- 1 | FROM cespi/php-5.3:apache-$TAG 2 | 3 | 4 | RUN apk add -U --no-cache \ 5 | autoconf \ 6 | libmemcached-dev \ 7 | libxml2-dev \ 8 | alpine-sdk \ 9 | mariadb-dev \ 10 | zlib-dev \ 11 | libxslt-dev \ 12 | openldap-dev \ 13 | libjpeg-turbo-dev \ 14 | libmcrypt-dev \ 15 | freetype-dev \ 16 | libpng-dev \ 17 | && pecl install apc \ 18 | && echo extension=apc.so > /usr/local/etc/php/conf.d/apc.ini \ 19 | && pecl install memcached-2.2.0 \ 20 | && echo extension=memcached.so > /usr/local/etc/php/conf.d/memcached.ini \ 21 | && pecl install memcache-2.2.7 \ 22 | && echo extension=memcache.so > /usr/local/etc/php/conf.d/memcache.ini \ 23 | && docker-php-ext-configure gd --with-png-dir=/usr --with-jpeg-dir=/usr/include --with-freetype-dir=/usr/include \ 24 | && docker-php-ext-install gd \ 25 | && docker-php-ext-configure ldap --with-libdir=lib/ \ 26 | && docker-php-ext-install mysql \ 27 | && docker-php-ext-install ldap \ 28 | && docker-php-ext-install bcmath \ 29 | && docker-php-ext-install soap \ 30 | && docker-php-ext-install xsl \ 31 | && docker-php-ext-install mcrypt \ 32 | && docker-php-ext-install mbstring pdo pdo_mysql zip \ 33 | && apk del --purge autoconf alpine-sdk mariadb-dev openldap-dev \ 34 | && apk add -U mariadb-client-libs libldap \ 35 | && cd /usr/local/bin \ 36 | && curl -sS https://getcomposer.org/installer | php \ 37 | && mv composer.phar composer \ 38 | && rm -rf /var/cache/apk/* 39 | -------------------------------------------------------------------------------- /apache/apache2-foreground: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | # 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. 5 | # (also, when run as "apache2ctl ", it does not use "exec", which leaves an undesirable resident shell process) 6 | 7 | : "${APACHE_CONFDIR:=/etc/apache2}" 8 | : "${APACHE_ENVVARS:=$APACHE_CONFDIR/envvars}" 9 | if test -f "$APACHE_ENVVARS"; then 10 | . "$APACHE_ENVVARS" 11 | fi 12 | 13 | 14 | # Apache gets grumpy about PID files pre-existing 15 | : "${APACHE_RUN_DIR:=/var/run/apache2}" 16 | : "${APACHE_PID_FILE:=$APACHE_RUN_DIR/apache2.pid}" 17 | rm -f "$APACHE_PID_FILE" 18 | 19 | # create missing directories 20 | # (especially APACHE_RUN_DIR, APACHE_LOCK_DIR, and APACHE_LOG_DIR) 21 | for e in "${!APACHE_@}"; do 22 | if [[ "$e" == *_DIR ]] && [[ "${!e}" == /* ]]; then 23 | # handle "/var/lock" being a symlink to "/run/lock", but "/run/lock" not existing beforehand, so "/var/lock/something" fails to mkdir 24 | # mkdir: cannot create directory '/var/lock': File exists 25 | dir="${!e}" 26 | while [ "$dir" != "$(dirname "$dir")" ]; do 27 | dir="$(dirname "$dir")" 28 | if [ -d "$dir" ]; then 29 | break 30 | fi 31 | absDir="$(readlink -f "$dir" 2>/dev/null || :)" 32 | if [ -n "$absDir" ]; then 33 | mkdir -p "$absDir" 34 | fi 35 | done 36 | 37 | mkdir -p "${!e}" 38 | fi 39 | done 40 | 41 | export PORT=${PORT:-80} 42 | export APACHE_RUN_USER=${APACHE_RUN_USER:-apache} 43 | export APACHE_RUN_GROUP=${APACHE_RUN_USER:-apache} 44 | export APACHE_DOCUMENT_ROOT=${APACHE_DOCUMENT_ROOT:-'/var/www/html/'} 45 | export DIRECTORY_OPTIONS=${DIRECTORY_OPTIONS:-'Indexes FollowSymLinks'} 46 | export ALLOW_OVERRIDE=${ALLOW_OVERRIDE:-'All'} 47 | 48 | envsubst '${PORT},${APACHE_RUN_USER},${APACHE_RUN_GROUP},${APACHE_DOCUMENT_ROOT},${DIRECTORY_OPTIONS},${ALLOW_OVERRIDE}' < /usr/local/etc/httpd.conf.tpl > /etc/apache2/httpd.conf 49 | 50 | exec httpd -DFOREGROUND "$@" 51 | -------------------------------------------------------------------------------- /docker-php-ext-enable: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | cd "$(php -r 'echo ini_get("extension_dir");')" 5 | 6 | usage() { 7 | echo "usage: $0 [options] module-name [module-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo " $0 --ini-name 0-apc.ini apcu apc" 11 | echo 12 | echo 'Possible values for module-name:' 13 | echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) 14 | } 15 | 16 | opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" 17 | eval set -- "$opts" 18 | 19 | iniName= 20 | while true; do 21 | flag="$1" 22 | shift 23 | case "$flag" in 24 | --help|-h|'-?') usage && exit 0 ;; 25 | --ini-name) iniName="$1" && shift ;; 26 | --) break ;; 27 | *) 28 | { 29 | echo "error: unknown flag: $flag" 30 | usage 31 | } >&2 32 | exit 1 33 | ;; 34 | esac 35 | done 36 | 37 | modules= 38 | for module; do 39 | if [ -z "$module" ]; then 40 | continue 41 | fi 42 | if [ -f "$module.so" ] && ! [ -f "$module" ]; then 43 | # allow ".so" to be optional 44 | module="$module.so" 45 | fi 46 | if ! [ -f "$module" ]; then 47 | echo >&2 "error: $(readlink -f "$module") does not exist" 48 | echo >&2 49 | usage >&2 50 | exit 1 51 | fi 52 | modules="$modules $module" 53 | done 54 | 55 | if [ -z "$modules" ]; then 56 | usage >&2 57 | exit 1 58 | fi 59 | 60 | for module in $modules; do 61 | if nm -g "$module" | grep -q ' zend_extension_entry$'; then 62 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 63 | line="zend_extension=$(readlink -f "$module")" 64 | else 65 | line="extension=$module" 66 | fi 67 | 68 | ext="$(basename "$module")" 69 | ext="${ext%.*}" 70 | if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then 71 | # this isn't perfect, but it's better than nothing 72 | # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') 73 | echo >&2 74 | echo >&2 "warning: $ext ($module) is already loaded!" 75 | echo >&2 76 | continue 77 | fi 78 | 79 | ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" 80 | if ! grep -q "$line" "$ini" 2>/dev/null; then 81 | echo "$line" >> "$ini" 82 | fi 83 | done 84 | -------------------------------------------------------------------------------- /apache/docker-php-ext-enable: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | cd "$(php -r 'echo ini_get("extension_dir");')" 5 | 6 | usage() { 7 | echo "usage: $0 [options] module-name [module-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo " $0 --ini-name 0-apc.ini apcu apc" 11 | echo 12 | echo 'Possible values for module-name:' 13 | echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) 14 | } 15 | 16 | opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" 17 | eval set -- "$opts" 18 | 19 | iniName= 20 | while true; do 21 | flag="$1" 22 | shift 23 | case "$flag" in 24 | --help|-h|'-?') usage && exit 0 ;; 25 | --ini-name) iniName="$1" && shift ;; 26 | --) break ;; 27 | *) 28 | { 29 | echo "error: unknown flag: $flag" 30 | usage 31 | } >&2 32 | exit 1 33 | ;; 34 | esac 35 | done 36 | 37 | modules= 38 | for module; do 39 | if [ -z "$module" ]; then 40 | continue 41 | fi 42 | if [ -f "$module.so" ] && ! [ -f "$module" ]; then 43 | # allow ".so" to be optional 44 | module="$module.so" 45 | fi 46 | if ! [ -f "$module" ]; then 47 | echo >&2 "error: $(readlink -f "$module") does not exist" 48 | echo >&2 49 | usage >&2 50 | exit 1 51 | fi 52 | modules="$modules $module" 53 | done 54 | 55 | if [ -z "$modules" ]; then 56 | usage >&2 57 | exit 1 58 | fi 59 | 60 | for module in $modules; do 61 | if nm -g "$module" | grep -q ' zend_extension_entry$'; then 62 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 63 | line="zend_extension=$(readlink -f "$module")" 64 | else 65 | line="extension=$module" 66 | fi 67 | 68 | ext="$(basename "$module")" 69 | ext="${ext%.*}" 70 | if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then 71 | # this isn't perfect, but it's better than nothing 72 | # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') 73 | echo >&2 74 | echo >&2 "warning: $ext ($module) is already loaded!" 75 | echo >&2 76 | continue 77 | fi 78 | 79 | ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" 80 | if ! grep -q "$line" "$ini" 2>/dev/null; then 81 | echo "$line" >> "$ini" 82 | fi 83 | done 84 | -------------------------------------------------------------------------------- /fpm/docker-php-ext-enable: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | cd "$(php -r 'echo ini_get("extension_dir");')" 5 | 6 | usage() { 7 | echo "usage: $0 [options] module-name [module-name ...]" 8 | echo " ie: $0 gd mysqli" 9 | echo " $0 pdo pdo_mysql" 10 | echo " $0 --ini-name 0-apc.ini apcu apc" 11 | echo 12 | echo 'Possible values for module-name:' 13 | echo $(find -maxdepth 1 -type f -name '*.so' -exec basename '{}' ';' | sort) 14 | } 15 | 16 | opts="$(getopt -o 'h?' --long 'help,ini-name:' -- "$@" || { usage >&2 && false; })" 17 | eval set -- "$opts" 18 | 19 | iniName= 20 | while true; do 21 | flag="$1" 22 | shift 23 | case "$flag" in 24 | --help|-h|'-?') usage && exit 0 ;; 25 | --ini-name) iniName="$1" && shift ;; 26 | --) break ;; 27 | *) 28 | { 29 | echo "error: unknown flag: $flag" 30 | usage 31 | } >&2 32 | exit 1 33 | ;; 34 | esac 35 | done 36 | 37 | modules= 38 | for module; do 39 | if [ -z "$module" ]; then 40 | continue 41 | fi 42 | if [ -f "$module.so" ] && ! [ -f "$module" ]; then 43 | # allow ".so" to be optional 44 | module="$module.so" 45 | fi 46 | if ! [ -f "$module" ]; then 47 | echo >&2 "error: $(readlink -f "$module") does not exist" 48 | echo >&2 49 | usage >&2 50 | exit 1 51 | fi 52 | modules="$modules $module" 53 | done 54 | 55 | if [ -z "$modules" ]; then 56 | usage >&2 57 | exit 1 58 | fi 59 | 60 | for module in $modules; do 61 | if nm -g "$module" | grep -q ' zend_extension_entry$'; then 62 | # https://wiki.php.net/internals/extensions#loading_zend_extensions 63 | line="zend_extension=$(readlink -f "$module")" 64 | else 65 | line="extension=$module" 66 | fi 67 | 68 | ext="$(basename "$module")" 69 | ext="${ext%.*}" 70 | if php -r 'exit(extension_loaded("'"$ext"'") ? 0 : 1);'; then 71 | # this isn't perfect, but it's better than nothing 72 | # (for example, 'opcache.so' presents inside PHP as 'Zend OPcache', not 'opcache') 73 | echo >&2 74 | echo >&2 "warning: $ext ($module) is already loaded!" 75 | echo >&2 76 | continue 77 | fi 78 | 79 | ini="/usr/local/etc/php/conf.d/${iniName:-"docker-php-ext-$ext.ini"}" 80 | if ! grep -q "$line" "$ini" 2>/dev/null; then 81 | echo "$line" >> "$ini" 82 | fi 83 | done 84 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # PHP 5.3 alpine based images 2 | 3 | PHP 5.3 [reached EOL](http://php.net/eol.php) on 14 Aug 2014 and thus, official docker support was [dropped](https://github.com/docker-library/php/pull/20). I still needed to run 5.3 with FPM so I built this image based on the latest official builds of PHP. 4 | 5 | ## Images 6 | 7 | This repo provides the following images: 8 | 9 | * cespi/php-5.3:cli-latest 10 | * cespi/php-5.3:apache-latest 11 | * cespi/php-5.3:fpm-latest 12 | 13 | All images are build from alpine 3.4 following the same criteria used to build 14 | current php library docker images 15 | 16 | ## Images with additional PHP modules commonly used 17 | 18 | Selected modules are commonly used by our organization. This images are: 19 | 20 | * cespi/php-5.3:modules-cli-latest 21 | * cespi/php-5.3:modules-apache-latest 22 | * cespi/php-5.3:modules-fpm-latest 23 | 24 | ## How we use it 25 | 26 | We define a bash script to work using php cli as follow: 27 | 28 | 1. Place the scripts from this repo at `vendor/bin` in $HOME/bin/ 29 | 2. Set an env variable named PHP_CLI_DOCKER_IMAGE with the image of a docker php 30 | cli image. For example: `PHP_CLI_DOCKER_IMAGE=cespi/php-5.3:modules-cli-latest` 31 | 3. Set an env variable named PHP_SERVER_DOCKER_RUN_OPTIONS with additional 32 | docker run arguments. 33 | 34 | You can then add this variables to your environment editing your `.bash_profile` 35 | or `.bashrc`, or instead use [direnv](https://github.com/direnv/direnv), so you can 36 | personalize a docker environment per project. 37 | 38 | ### Install scripts 39 | 40 | Run the following command: 41 | 42 | ```bash 43 | mkdir -p $HOME/bin && \ 44 | curl https://raw.githubusercontent.com/Desarrollo-CeSPI/docker-php-5.3-alpine/master/vendor/bin/php -s \ 45 | > $HOME/bin/php && chmod +x $HOME/bin/php && \ 46 | curl https://raw.githubusercontent.com/Desarrollo-CeSPI/docker-php-5.3-alpine/master/vendor/bin/php-server -s \ 47 | > $HOME/bin/php-server && chmod +x $HOME/bin/php-server 48 | ``` 49 | 50 | _Make sure `$HOME/bin` is the first entry on your `$PATH`_ 51 | 52 | If `php-server` gives the following error: 53 | 54 | ```bash 55 | Variable PHP_SERVER_LOCAL_PHP_INI must be set with a valid php ini file. It now 56 | points to /home/car/bin/etc/docker/php/php.ini, but file seems to not exist 57 | ``` 58 | 59 | You must set PHP_SERVER_LOCAL_PHP_INI with a valid php ini file 60 | 61 | ### Sample personalization per project using direnv 62 | 63 | ```bash 64 | PHP_CLI_DOCKER_IMAGE=cespi/php-5.3:modules-cli-latest 65 | PHP_SERVER_DOCKER_RUN_OPTIONS="--add-host local.docker:172.17.0.1 -e APACHE_RUN_USER=$USER -e APACHE_RUN_GROUP=`id -ng $USER` -v $HOME/docker/php/php.ini:/usr/local/etc/php/conf.d/my-custom-php.ini:ro" 66 | ``` 67 | 68 | Then, in any directory you can run php scripts or php-server script to launch a 69 | php web server 70 | -------------------------------------------------------------------------------- /docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # prefer user supplied CFLAGS, but default to our PHP_CFLAGS 5 | : ${CFLAGS:=$PHP_CFLAGS} 6 | : ${CPPFLAGS:=$PHP_CPPFLAGS} 7 | : ${LDFLAGS:=$PHP_LDFLAGS} 8 | export CFLAGS CPPFLAGS LDFLAGS 9 | 10 | srcExists= 11 | if [ -d /usr/src/php ]; then 12 | srcExists=1 13 | fi 14 | docker-php-source extract 15 | if [ -z "$srcExists" ]; then 16 | touch /usr/src/php/.docker-delete-me 17 | fi 18 | 19 | cd /usr/src/php/ext 20 | 21 | usage() { 22 | echo "usage: $0 [-jN] ext-name [ext-name ...]" 23 | echo " ie: $0 gd mysqli" 24 | echo " $0 pdo pdo_mysql" 25 | echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" 26 | echo 27 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 28 | echo 29 | echo 'Possible values for ext-name:' 30 | find . \ 31 | -mindepth 2 \ 32 | -maxdepth 2 \ 33 | -type f \ 34 | -name 'config.m4' \ 35 | | xargs -n1 dirname \ 36 | | xargs -n1 basename \ 37 | | sort \ 38 | | xargs 39 | } 40 | 41 | opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" 42 | eval set -- "$opts" 43 | 44 | j=1 45 | while true; do 46 | flag="$1" 47 | shift 48 | case "$flag" in 49 | --help|-h|'-?') usage && exit 0 ;; 50 | --jobs|-j) j="$1" && shift ;; 51 | --) break ;; 52 | *) 53 | { 54 | echo "error: unknown flag: $flag" 55 | usage 56 | } >&2 57 | exit 1 58 | ;; 59 | esac 60 | done 61 | 62 | exts= 63 | for ext; do 64 | if [ -z "$ext" ]; then 65 | continue 66 | fi 67 | if [ ! -d "$ext" ]; then 68 | echo >&2 "error: $PWD/$ext does not exist" 69 | echo >&2 70 | usage >&2 71 | exit 1 72 | fi 73 | exts="$exts $ext" 74 | done 75 | 76 | if [ -z "$exts" ]; then 77 | usage >&2 78 | exit 1 79 | fi 80 | 81 | pm='unknown' 82 | if [ -e /lib/apk/db/installed ]; then 83 | pm='apk' 84 | fi 85 | 86 | apkDel= 87 | if [ "$pm" = 'apk' ]; then 88 | if [ -n "$PHPIZE_DEPS" ]; then 89 | if apk info --installed .phpize-deps-configure > /dev/null; then 90 | apkDel='.phpize-deps-configure' 91 | elif ! apk info --installed .phpize-deps > /dev/null; then 92 | apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS 93 | apkDel='.phpize-deps' 94 | fi 95 | fi 96 | fi 97 | 98 | popDir="$PWD" 99 | for ext in $exts; do 100 | cd "$ext" 101 | [ -e Makefile ] || docker-php-ext-configure "$ext" 102 | make -j"$j" 103 | make -j"$j" install 104 | find modules \ 105 | -maxdepth 1 \ 106 | -name '*.so' \ 107 | -exec basename '{}' ';' \ 108 | | xargs -r docker-php-ext-enable 109 | make -j"$j" clean 110 | cd "$popDir" 111 | done 112 | 113 | if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then 114 | apk del $apkDel 115 | fi 116 | 117 | if [ -e /usr/src/php/.docker-delete-me ]; then 118 | docker-php-source delete 119 | fi 120 | -------------------------------------------------------------------------------- /apache/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # prefer user supplied CFLAGS, but default to our PHP_CFLAGS 5 | : ${CFLAGS:=$PHP_CFLAGS} 6 | : ${CPPFLAGS:=$PHP_CPPFLAGS} 7 | : ${LDFLAGS:=$PHP_LDFLAGS} 8 | export CFLAGS CPPFLAGS LDFLAGS 9 | 10 | srcExists= 11 | if [ -d /usr/src/php ]; then 12 | srcExists=1 13 | fi 14 | docker-php-source extract 15 | if [ -z "$srcExists" ]; then 16 | touch /usr/src/php/.docker-delete-me 17 | fi 18 | 19 | cd /usr/src/php/ext 20 | 21 | usage() { 22 | echo "usage: $0 [-jN] ext-name [ext-name ...]" 23 | echo " ie: $0 gd mysqli" 24 | echo " $0 pdo pdo_mysql" 25 | echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" 26 | echo 27 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 28 | echo 29 | echo 'Possible values for ext-name:' 30 | find . \ 31 | -mindepth 2 \ 32 | -maxdepth 2 \ 33 | -type f \ 34 | -name 'config.m4' \ 35 | | xargs -n1 dirname \ 36 | | xargs -n1 basename \ 37 | | sort \ 38 | | xargs 39 | } 40 | 41 | opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" 42 | eval set -- "$opts" 43 | 44 | j=1 45 | while true; do 46 | flag="$1" 47 | shift 48 | case "$flag" in 49 | --help|-h|'-?') usage && exit 0 ;; 50 | --jobs|-j) j="$1" && shift ;; 51 | --) break ;; 52 | *) 53 | { 54 | echo "error: unknown flag: $flag" 55 | usage 56 | } >&2 57 | exit 1 58 | ;; 59 | esac 60 | done 61 | 62 | exts= 63 | for ext; do 64 | if [ -z "$ext" ]; then 65 | continue 66 | fi 67 | if [ ! -d "$ext" ]; then 68 | echo >&2 "error: $PWD/$ext does not exist" 69 | echo >&2 70 | usage >&2 71 | exit 1 72 | fi 73 | exts="$exts $ext" 74 | done 75 | 76 | if [ -z "$exts" ]; then 77 | usage >&2 78 | exit 1 79 | fi 80 | 81 | pm='unknown' 82 | if [ -e /lib/apk/db/installed ]; then 83 | pm='apk' 84 | fi 85 | 86 | apkDel= 87 | if [ "$pm" = 'apk' ]; then 88 | if [ -n "$PHPIZE_DEPS" ]; then 89 | if apk info --installed .phpize-deps-configure > /dev/null; then 90 | apkDel='.phpize-deps-configure' 91 | elif ! apk info --installed .phpize-deps > /dev/null; then 92 | apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS 93 | apkDel='.phpize-deps' 94 | fi 95 | fi 96 | fi 97 | 98 | popDir="$PWD" 99 | for ext in $exts; do 100 | cd "$ext" 101 | [ -e Makefile ] || docker-php-ext-configure "$ext" 102 | make -j"$j" 103 | make -j"$j" install 104 | find modules \ 105 | -maxdepth 1 \ 106 | -name '*.so' \ 107 | -exec basename '{}' ';' \ 108 | | xargs -r docker-php-ext-enable 109 | make -j"$j" clean 110 | cd "$popDir" 111 | done 112 | 113 | if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then 114 | apk del $apkDel 115 | fi 116 | 117 | if [ -e /usr/src/php/.docker-delete-me ]; then 118 | docker-php-source delete 119 | fi 120 | -------------------------------------------------------------------------------- /fpm/docker-php-ext-install: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | set -e 3 | 4 | # prefer user supplied CFLAGS, but default to our PHP_CFLAGS 5 | : ${CFLAGS:=$PHP_CFLAGS} 6 | : ${CPPFLAGS:=$PHP_CPPFLAGS} 7 | : ${LDFLAGS:=$PHP_LDFLAGS} 8 | export CFLAGS CPPFLAGS LDFLAGS 9 | 10 | srcExists= 11 | if [ -d /usr/src/php ]; then 12 | srcExists=1 13 | fi 14 | docker-php-source extract 15 | if [ -z "$srcExists" ]; then 16 | touch /usr/src/php/.docker-delete-me 17 | fi 18 | 19 | cd /usr/src/php/ext 20 | 21 | usage() { 22 | echo "usage: $0 [-jN] ext-name [ext-name ...]" 23 | echo " ie: $0 gd mysqli" 24 | echo " $0 pdo pdo_mysql" 25 | echo " $0 -j5 gd mbstring mysqli pdo pdo_mysql shmop" 26 | echo 27 | echo 'if custom ./configure arguments are necessary, see docker-php-ext-configure' 28 | echo 29 | echo 'Possible values for ext-name:' 30 | find . \ 31 | -mindepth 2 \ 32 | -maxdepth 2 \ 33 | -type f \ 34 | -name 'config.m4' \ 35 | | xargs -n1 dirname \ 36 | | xargs -n1 basename \ 37 | | sort \ 38 | | xargs 39 | } 40 | 41 | opts="$(getopt -o 'h?j:' --long 'help,jobs:' -- "$@" || { usage >&2 && false; })" 42 | eval set -- "$opts" 43 | 44 | j=1 45 | while true; do 46 | flag="$1" 47 | shift 48 | case "$flag" in 49 | --help|-h|'-?') usage && exit 0 ;; 50 | --jobs|-j) j="$1" && shift ;; 51 | --) break ;; 52 | *) 53 | { 54 | echo "error: unknown flag: $flag" 55 | usage 56 | } >&2 57 | exit 1 58 | ;; 59 | esac 60 | done 61 | 62 | exts= 63 | for ext; do 64 | if [ -z "$ext" ]; then 65 | continue 66 | fi 67 | if [ ! -d "$ext" ]; then 68 | echo >&2 "error: $PWD/$ext does not exist" 69 | echo >&2 70 | usage >&2 71 | exit 1 72 | fi 73 | exts="$exts $ext" 74 | done 75 | 76 | if [ -z "$exts" ]; then 77 | usage >&2 78 | exit 1 79 | fi 80 | 81 | pm='unknown' 82 | if [ -e /lib/apk/db/installed ]; then 83 | pm='apk' 84 | fi 85 | 86 | apkDel= 87 | if [ "$pm" = 'apk' ]; then 88 | if [ -n "$PHPIZE_DEPS" ]; then 89 | if apk info --installed .phpize-deps-configure > /dev/null; then 90 | apkDel='.phpize-deps-configure' 91 | elif ! apk info --installed .phpize-deps > /dev/null; then 92 | apk add --no-cache --virtual .phpize-deps $PHPIZE_DEPS 93 | apkDel='.phpize-deps' 94 | fi 95 | fi 96 | fi 97 | 98 | popDir="$PWD" 99 | for ext in $exts; do 100 | cd "$ext" 101 | [ -e Makefile ] || docker-php-ext-configure "$ext" 102 | make -j"$j" 103 | make -j"$j" install 104 | find modules \ 105 | -maxdepth 1 \ 106 | -name '*.so' \ 107 | -exec basename '{}' ';' \ 108 | | xargs -r docker-php-ext-enable 109 | make -j"$j" clean 110 | cd "$popDir" 111 | done 112 | 113 | if [ "$pm" = 'apk' ] && [ -n "$apkDel" ]; then 114 | apk del $apkDel 115 | fi 116 | 117 | if [ -e /usr/src/php/.docker-delete-me ]; then 118 | docker-php-source delete 119 | fi 120 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | sudo: required 2 | 3 | services: 4 | - docker 5 | 6 | env: 7 | global: 8 | - secure: fILf4GslAy3BESZrXbYvdEdJYtM3Vhj4NFL9G60E4eUMw8lBzg6VkU1fohL4LIVeY6u2g5yKfInIjDdUY6BnX8k/Q44xrTDME7IkSJgwFcqaIBPPDtsCIUqRVh17HpNO1hLLpGTWpxyUDeeLAmW7jO4tYCmJsujuxL90/qDTHVRBPb8rp+bMhy9zHAf+2gzJ6TYCzpq/JFFCY0B0SksQFaMQIdPZmejUqCsYQe7m1QB8YTcA/Kupz4XQXGqm9FSjWtT9NnGuUTh6gkg53v4iaizl+2IjznQtdLXVCON1RbXaWXHACgdQLWaxfSJp7X/+RHR+ILhhI3SlOpCfa1C2CcVav4UlWpAda7QhXzfe9CfggV1NmsvhdGjynDq0LAl3C5nZOOkIRCEJ3fHaQj9z5ChNL2cKWYhqKD2kdMHEUe5K0BtdpognQcKVwmwFM6cwxsqXmWOUZ75daNL/dvBtZui8b8ErdRUb/ktjm2wV7w5/5Lp9D0mCmcqNHeXLTRIjtAK1N3EgocOodo7S2KNA5Lz3BRFa+7CzS5cz8SRXQXkLQKzudHdk3rnIF+gdz+NetegO3yyokO28qMASqBtjSI1//abjDqo5jeSCjnFJsENX6HvKmDSYhf7CZ98auRWJWGW9qehHPlTTd3884L52uQBdZEaZ5AaXse/TB6WV9OE= 9 | - secure: x0c528lYVaF8dEiPj2CyCdTE5G0NnDXZT/MPuE/gg4COZMlUTzhwgR37WtoQOUvXp9MYHcRmcbLl3+/fMU1e7iDd/NXyAzI8dW0DTNg6kPB9m0UNe8CavYLWiqRelrBACnkXHNpvo7cncL95BUk+4X2c9disD6tj/Z5181YsQ4CpeEAb4uqT6D7r5aAtDnwHXt3W1i2jUlJUVe/8/HgA98R7F59bQBpxxMigqFeP/W4aJUAtqgghSvuDxE9efMOxufx/s3fL13bYrLjjydZWlfyToCWWb9JMUX8hYWp/h3tsf8BtYLaDnmPdzD9WF1i89wis1+JcutcTn1WhW6JgL64tD7w4yZJjspQ9UAgbeAv72+Qcw1yewMMK0uf9aBtauPiaey2Z3o3PLWVo15Wqay7WpDZopPoIv3Tkzbeys9AUiwLSNvzf4KhGV9fVqhRYcm2DDFepOGxdNHae9ElEJ/+kdRJzfBlwX6xUjHa08p9WewApNoH3hveC5i8MEfbFt1/3E26m0xThHjwUKbJjrhzsR8XEF5uA7GJEwR/HciFF0DEFn3bHFlTM6v18cBLsKOimmHLEHtQ1vwlFTKALik8BmnqipVURdUfZNVAZItq6ldmz/XS1JBg49M/yHRc/X5hlcRVPVFMJnhew7HtGwqiZyzdmEB5tQtei2PcANcM= 10 | - secure: XNTRbkVKG9ARPg+F7jfMmPqsQOvdMrLfjzhgV4QbXlqVEIHyLs/lUEjitKivucitv9mwzR2ji6YPy+YWT7+IDbxXTMadSJkdztg53Mo91iEQzElyGkeAoMzv6GRxdjgdf8xZuWVLLgoRLE8qkSm/uyo+qFjV01Nz5pNdEgTWI1uXOiZ5cThOnOZV5vNIT+PowPTK2aXrQYLrv9aKOMxpHO/5BNQgo4SqSuQQdB2V3kGtKnR2iJxj0vZYoGwQCVQQ/jXbtfsX192NQW3WVFVfYH8NOzwHHTIUP3l7USkVBnkVqeKTJvLOCcLMgRtf9gI8Uc84dXO8kStEhdgUojUNVdurtxHOBLyMAiWiMEIaSigl4gRuFvVd6fVzHKhMFrMHpj+W8Gwb716/cNMjQm18Rvr+LVkc4okCk31GjeXNgK81YlwslckCeOEwLGm2KFZLhINjnkMOJwMBuBHZAN9sqACDdF2izE5rhNEGZy7sdkdKVwg+IxyyeOknzCMWjB78iIiqH+tZQqeHj+eDEMfdiA9hpYDMHtn/zlOhrIdCmoGCeaClE4kPY5Qn3sQwVDEXuQiQgiUlDOYdXnFGeStqe7EjXwvdJ1fGvCQQS6RxZY4qGGXtSsw9dVxHjCMO68TzpiAlY9OXQ9GWy5bS3cNk55S+DpR0WMFGRMIkzYPopVs= 11 | 12 | 13 | install: 14 | - echo "install nothing!" # put your normal pre-testing installs here 15 | 16 | script: 17 | - echo "no tests!" # put your normal testing scripts here 18 | 19 | after_success: 20 | - docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD 21 | - export REPO=cespi/php-5.3 22 | - export TAG=`if [ "$TRAVIS_BRANCH" == "master" ]; then echo "latest"; else echo $TRAVIS_BRANCH ; fi` 23 | - docker build -f Dockerfile -t $REPO:cli-$TAG . 24 | - docker build -f apache/Dockerfile -t $REPO:apache-$TAG ./apache 25 | - docker build -f fpm/Dockerfile -t $REPO:fpm-$TAG ./fpm 26 | - docker push $REPO:cli-$TAG 27 | - docker push $REPO:apache-$TAG 28 | - docker push $REPO:fpm-$TAG 29 | - envsubst '$TAG' < with-modules/Dockerfile.tpl > with-modules/Dockerfile 30 | - docker build -f with-modules/Dockerfile -t $REPO:modules-cli-$TAG ./with-modules 31 | - envsubst '$TAG' < with-modules/apache/Dockerfile.tpl > with-modules/apache/Dockerfile 32 | - docker build -f with-modules/apache/Dockerfile -t $REPO:modules-apache-$TAG ./with-modules/apache 33 | - envsubst '$TAG' < with-modules/fpm/Dockerfile.tpl > with-modules/fpm/Dockerfile 34 | - docker build -f with-modules/fpm/Dockerfile -t $REPO:modules-fpm-$TAG ./with-modules/fpm 35 | - docker push $REPO:modules-cli-$TAG 36 | - docker push $REPO:modules-apache-$TAG 37 | - docker push $REPO:modules-fpm-$TAG 38 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.4 8 | 9 | # persistent / runtime deps 10 | ENV PHPIZE_DEPS \ 11 | autoconf \ 12 | file \ 13 | g++ \ 14 | gcc \ 15 | libc-dev \ 16 | make \ 17 | pkgconf \ 18 | re2c 19 | RUN apk add --no-cache --virtual .persistent-deps \ 20 | ca-certificates \ 21 | curl \ 22 | tar \ 23 | xz 24 | 25 | # ensure www-data user exists 26 | RUN set -x \ 27 | && addgroup -g 82 -S www-data \ 28 | && adduser -u 82 -D -S -G www-data www-data 29 | # 82 is the standard uid/gid for "www-data" in Alpine 30 | # http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2 31 | # http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2 32 | # http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2 33 | 34 | ENV PHP_INI_DIR /usr/local/etc/php 35 | RUN mkdir -p $PHP_INI_DIR/conf.d 36 | 37 | #### 38 | #### 39 | 40 | # Apply stack smash protection to functions using local buffers and alloca() 41 | # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) 42 | # Enable optimization (-O2) 43 | # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) 44 | # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) 45 | # https://github.com/docker-library/php/issues/272 46 | ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" 47 | ENV PHP_CPPFLAGS="$PHP_CFLAGS" 48 | ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" 49 | 50 | ENV PHP_VERSION 5.3.29 51 | ENV PHP_URL="https://secure.php.net/get/php-${PHP_VERSION}.tar.xz/from/this/mirror" PHP_ASC_URL="https://secure.php.net/get/php-${PHP_VERSION}.tar.xz.asc/from/this/mirror" 52 | 53 | RUN set -xe; \ 54 | \ 55 | apk add --no-cache --virtual .fetch-deps \ 56 | gnupg \ 57 | openssl \ 58 | ; \ 59 | \ 60 | mkdir -p /usr/src; \ 61 | cd /usr/src; \ 62 | \ 63 | wget -O php.tar.xz "$PHP_URL"; \ 64 | \ 65 | apk del .fetch-deps 66 | 67 | COPY docker-php-source /usr/local/bin/ 68 | 69 | RUN set -xe \ 70 | && apk add --no-cache --virtual .build-deps \ 71 | $PHPIZE_DEPS \ 72 | curl-dev \ 73 | libedit-dev \ 74 | libxml2-dev \ 75 | openssl-dev \ 76 | sqlite-dev \ 77 | \ 78 | && export CFLAGS="$PHP_CFLAGS" \ 79 | CPPFLAGS="$PHP_CPPFLAGS" \ 80 | LDFLAGS="$PHP_LDFLAGS" \ 81 | && docker-php-source extract \ 82 | && cd /usr/src/php \ 83 | && ./configure \ 84 | --with-config-file-path="$PHP_INI_DIR" \ 85 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 86 | \ 87 | --disable-cgi \ 88 | \ 89 | # --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) 90 | --enable-ftp \ 91 | # --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) 92 | --enable-mbstring \ 93 | # --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) 94 | --enable-mysqlnd \ 95 | \ 96 | --with-curl \ 97 | --with-libedit \ 98 | --with-openssl \ 99 | --with-zlib \ 100 | \ 101 | $PHP_EXTRA_CONFIGURE_ARGS \ 102 | && make -j "$(getconf _NPROCESSORS_ONLN)" \ 103 | && make install \ 104 | && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \ 105 | && make clean \ 106 | && docker-php-source delete \ 107 | \ 108 | && runDeps="$( \ 109 | scanelf --needed --nobanner --recursive /usr/local \ 110 | | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ 111 | | sort -u \ 112 | | xargs -r apk info --installed \ 113 | | sort -u \ 114 | )" \ 115 | && apk add --no-cache --virtual .php-rundeps $runDeps \ 116 | \ 117 | && apk del .build-deps 118 | 119 | COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ 120 | 121 | ENTRYPOINT ["docker-php-entrypoint"] 122 | CMD ["php", "-a"] 123 | -------------------------------------------------------------------------------- /fpm/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.4 8 | 9 | # persistent / runtime deps 10 | ENV PHPIZE_DEPS \ 11 | autoconf \ 12 | file \ 13 | g++ \ 14 | gcc \ 15 | libc-dev \ 16 | make \ 17 | pkgconf \ 18 | re2c 19 | RUN apk add --no-cache --virtual .persistent-deps \ 20 | ca-certificates \ 21 | curl \ 22 | tar \ 23 | xz 24 | 25 | # ensure www-data user exists 26 | RUN set -x \ 27 | && addgroup -g 82 -S www-data \ 28 | && adduser -u 82 -D -S -G www-data www-data 29 | # 82 is the standard uid/gid for "www-data" in Alpine 30 | # http://git.alpinelinux.org/cgit/aports/tree/main/apache2/apache2.pre-install?h=v3.3.2 31 | # http://git.alpinelinux.org/cgit/aports/tree/main/lighttpd/lighttpd.pre-install?h=v3.3.2 32 | # http://git.alpinelinux.org/cgit/aports/tree/main/nginx-initscripts/nginx-initscripts.pre-install?h=v3.3.2 33 | 34 | ENV PHP_INI_DIR /usr/local/etc/php 35 | RUN mkdir -p $PHP_INI_DIR/conf.d 36 | 37 | #### 38 | ENV PHP_EXTRA_CONFIGURE_ARGS --enable-fpm --with-fpm-user=www-data --with-fpm-group=www-data 39 | #### 40 | 41 | # Apply stack smash protection to functions using local buffers and alloca() 42 | # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) 43 | # Enable optimization (-O2) 44 | # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) 45 | # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) 46 | # https://github.com/docker-library/php/issues/272 47 | ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" 48 | ENV PHP_CPPFLAGS="$PHP_CFLAGS" 49 | ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" 50 | 51 | ENV PHP_VERSION 5.3.29 52 | ENV PHP_URL="https://secure.php.net/get/php-${PHP_VERSION}.tar.xz/from/this/mirror" PHP_ASC_URL="https://secure.php.net/get/php-${PHP_VERSION}.tar.xz.asc/from/this/mirror" 53 | 54 | RUN set -xe; \ 55 | \ 56 | apk add --no-cache --virtual .fetch-deps \ 57 | gnupg \ 58 | openssl \ 59 | ; \ 60 | \ 61 | mkdir -p /usr/src; \ 62 | cd /usr/src; \ 63 | \ 64 | wget -O php.tar.xz "$PHP_URL"; \ 65 | \ 66 | apk del .fetch-deps 67 | 68 | COPY docker-php-source /usr/local/bin/ 69 | 70 | RUN set -xe \ 71 | && apk add --no-cache --virtual .build-deps \ 72 | $PHPIZE_DEPS \ 73 | curl-dev \ 74 | libedit-dev \ 75 | libxml2-dev \ 76 | openssl-dev \ 77 | sqlite-dev \ 78 | \ 79 | && export CFLAGS="$PHP_CFLAGS" \ 80 | CPPFLAGS="$PHP_CPPFLAGS" \ 81 | LDFLAGS="$PHP_LDFLAGS" \ 82 | && docker-php-source extract \ 83 | && cd /usr/src/php \ 84 | && ./configure \ 85 | --with-config-file-path="$PHP_INI_DIR" \ 86 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 87 | \ 88 | --disable-cgi \ 89 | \ 90 | # --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) 91 | --enable-ftp \ 92 | # --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) 93 | --enable-mbstring \ 94 | # --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) 95 | --enable-mysqlnd \ 96 | \ 97 | --with-curl \ 98 | --with-libedit \ 99 | --with-openssl \ 100 | --with-zlib \ 101 | \ 102 | $PHP_EXTRA_CONFIGURE_ARGS \ 103 | && make -j "$(getconf _NPROCESSORS_ONLN)" \ 104 | && make install \ 105 | && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \ 106 | && make clean \ 107 | && docker-php-source delete \ 108 | \ 109 | && runDeps="$( \ 110 | scanelf --needed --nobanner --recursive /usr/local \ 111 | | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ 112 | | sort -u \ 113 | | xargs -r apk info --installed \ 114 | | sort -u \ 115 | )" \ 116 | && apk add --no-cache --virtual .php-rundeps $runDeps \ 117 | \ 118 | && apk del .build-deps 119 | 120 | COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ 121 | 122 | ENTRYPOINT ["docker-php-entrypoint"] 123 | WORKDIR /var/www/html 124 | 125 | RUN set -ex \ 126 | && cd /usr/local/etc \ 127 | && if [ -d php-fpm.d ]; then \ 128 | # for some reason, upstream's php-fpm.conf.default has "include=NONE/etc/php-fpm.d/*.conf" 129 | sed 's!=NONE/!=!g' php-fpm.conf.default | tee php-fpm.conf > /dev/null; \ 130 | cp php-fpm.d/www.conf.default php-fpm.d/www.conf; \ 131 | else \ 132 | # PHP 5.x doesn't use "include=" by default, so we'll create our own simple config that mimics PHP 7+ for consistency 133 | mkdir php-fpm.d; \ 134 | cp php-fpm.conf.default php-fpm.d/www.conf; \ 135 | { \ 136 | echo '[global]'; \ 137 | echo 'include=etc/php-fpm.d/*.conf'; \ 138 | } | tee php-fpm.conf; \ 139 | fi \ 140 | && { \ 141 | echo '[global]'; \ 142 | echo 'error_log = /proc/self/fd/2'; \ 143 | echo; \ 144 | echo '[www]'; \ 145 | echo '; if we send this to /proc/self/fd/1, it never appears'; \ 146 | echo 'access.log = /proc/self/fd/2'; \ 147 | echo; \ 148 | echo '; Ensure worker stdout and stderr are sent to the main error log.'; \ 149 | echo 'catch_workers_output = yes'; \ 150 | } | tee php-fpm.d/docker.conf \ 151 | && { \ 152 | echo '[global]'; \ 153 | echo 'daemonize = no'; \ 154 | echo; \ 155 | echo '[www]'; \ 156 | echo 'listen = 9000'; \ 157 | } | tee php-fpm.d/zz-docker.conf \ 158 | && sed -i 's/^listen =/;listen =/' /usr/local/etc/php-fpm.d/www.conf \ 159 | && sed -i 's/^listen =/;listen =/' /usr/local/etc/php-fpm.conf.default 160 | 161 | EXPOSE 9000 162 | CMD ["php-fpm"] 163 | -------------------------------------------------------------------------------- /apache/Dockerfile: -------------------------------------------------------------------------------- 1 | # 2 | # NOTE: THIS DOCKERFILE IS GENERATED VIA "update.sh" 3 | # 4 | # PLEASE DO NOT EDIT IT DIRECTLY. 5 | # 6 | 7 | FROM alpine:3.4 8 | 9 | # persistent / runtime deps 10 | ENV PHPIZE_DEPS \ 11 | autoconf \ 12 | file \ 13 | g++ \ 14 | gcc \ 15 | libc-dev \ 16 | make \ 17 | pkgconf \ 18 | re2c 19 | RUN apk add --no-cache --virtual .persistent-deps \ 20 | ca-certificates \ 21 | curl \ 22 | tar \ 23 | apache2 \ 24 | gettext \ 25 | bash \ 26 | xz 27 | 28 | ENV PHP_INI_DIR /usr/local/etc/php 29 | RUN mkdir -p $PHP_INI_DIR/conf.d 30 | 31 | #### 32 | #### 33 | 34 | # Apply stack smash protection to functions using local buffers and alloca() 35 | # Make PHP's main executable position-independent (improves ASLR security mechanism, and has no performance impact on x86_64) 36 | # Enable optimization (-O2) 37 | # Enable linker optimization (this sorts the hash buckets to improve cache locality, and is non-default) 38 | # Adds GNU HASH segments to generated executables (this is used if present, and is much faster than sysv hash; in this configuration, sysv hash is also generated) 39 | # https://github.com/docker-library/php/issues/272 40 | ENV PHP_CFLAGS="-fstack-protector-strong -fpic -fpie -O2" 41 | ENV PHP_CPPFLAGS="$PHP_CFLAGS" 42 | ENV PHP_LDFLAGS="-Wl,-O1 -Wl,--hash-style=both -pie" 43 | ENV PHP_EXTRA_CONFIGURE_ARGS --with-apxs2 44 | 45 | ENV PHP_VERSION 5.3.29 46 | ENV PHP_URL="https://secure.php.net/get/php-${PHP_VERSION}.tar.xz/from/this/mirror" PHP_ASC_URL="https://secure.php.net/get/php-${PHP_VERSION}.tar.xz.asc/from/this/mirror" 47 | 48 | RUN set -xe; \ 49 | \ 50 | apk add --no-cache --virtual .fetch-deps \ 51 | gnupg \ 52 | openssl \ 53 | ; \ 54 | \ 55 | mkdir -p /usr/src; \ 56 | cd /usr/src; \ 57 | \ 58 | wget -O php.tar.xz "$PHP_URL"; \ 59 | \ 60 | apk del .fetch-deps 61 | 62 | COPY docker-php-source /usr/local/bin/ 63 | 64 | RUN set -xe \ 65 | && apk add --no-cache --virtual .build-deps \ 66 | $PHPIZE_DEPS \ 67 | curl-dev \ 68 | libedit-dev \ 69 | libxml2-dev \ 70 | openssl-dev \ 71 | sqlite-dev \ 72 | apache2-dev \ 73 | \ 74 | && export CFLAGS="$PHP_CFLAGS" \ 75 | CPPFLAGS="$PHP_CPPFLAGS" \ 76 | LDFLAGS="$PHP_LDFLAGS" \ 77 | && docker-php-source extract \ 78 | && cd /usr/src/php \ 79 | && ./configure \ 80 | --with-config-file-path="$PHP_INI_DIR" \ 81 | --with-config-file-scan-dir="$PHP_INI_DIR/conf.d" \ 82 | \ 83 | --disable-cgi \ 84 | \ 85 | # --enable-ftp is included here because ftp_ssl_connect() needs ftp to be compiled statically (see https://github.com/docker-library/php/issues/236) 86 | --enable-ftp \ 87 | # --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) 88 | --enable-mbstring \ 89 | # --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) 90 | --enable-mysqlnd \ 91 | \ 92 | --with-curl \ 93 | --with-libedit \ 94 | --with-openssl \ 95 | --with-zlib \ 96 | \ 97 | $PHP_EXTRA_CONFIGURE_ARGS \ 98 | && make -j "$(getconf _NPROCESSORS_ONLN)" \ 99 | && make install \ 100 | && { find /usr/local/bin /usr/local/sbin -type f -perm +0111 -exec strip --strip-all '{}' + || true; } \ 101 | && make clean \ 102 | && docker-php-source delete \ 103 | \ 104 | && runDeps="$( \ 105 | scanelf --needed --nobanner --recursive /usr/local \ 106 | | awk '{ gsub(/,/, "\nso:", $2); print "so:" $2 }' \ 107 | | sort -u \ 108 | | xargs -r apk info --installed \ 109 | | sort -u \ 110 | )" \ 111 | && apk add --no-cache --virtual .php-rundeps $runDeps \ 112 | \ 113 | && apk del .build-deps 114 | 115 | ENV APACHE_CONFDIR /etc/apache2 116 | ENV APACHE_ENVVARS $APACHE_CONFDIR/envvars 117 | 118 | COPY envvars $APACHE_ENVVARS 119 | 120 | RUN set -ex \ 121 | \ 122 | # generically convert lines like 123 | # export APACHE_RUN_USER=apache 124 | # into 125 | # : ${APACHE_RUN_USER:=apache} 126 | # export APACHE_RUN_USER 127 | # so that they can be overridden at runtime ("-e APACHE_RUN_USER=...") 128 | && sed -ri 's/^export ([^=]+)=(.*)$/: ${\1:=\2}\nexport \1/' "$APACHE_ENVVARS" \ 129 | \ 130 | # setup directories and permissions 131 | && . "$APACHE_ENVVARS" \ 132 | && for dir in \ 133 | "$APACHE_LOCK_DIR" \ 134 | "$APACHE_RUN_DIR" \ 135 | "$APACHE_LOG_DIR" \ 136 | /var/www/html \ 137 | ; do \ 138 | rm -rvf "$dir" \ 139 | && mkdir -p "$dir" \ 140 | && chown -R "$APACHE_RUN_USER:$APACHE_RUN_GROUP" "$dir"; \ 141 | done \ 142 | && rm -fr /var/www/localhost 143 | 144 | # logs should go to stdout / stderr 145 | RUN set -ex \ 146 | && . "$APACHE_ENVVARS" \ 147 | && ln -sfT /dev/stderr "$APACHE_LOG_DIR/error.log" \ 148 | && ln -sfT /dev/stdout "$APACHE_LOG_DIR/access.log" \ 149 | && ln -sfT /dev/stdout "$APACHE_LOG_DIR/other_vhosts_access.log" 150 | 151 | # PHP files should be handled by PHP, and should be preferred over any other file type 152 | RUN { \ 153 | echo -e ''; \ 154 | echo -e '\tSetHandler application/x-httpd-php'; \ 155 | echo -e ''; \ 156 | echo; \ 157 | echo -e 'DirectoryIndex disabled'; \ 158 | echo -e 'DirectoryIndex index.php index.html'; \ 159 | echo; \ 160 | echo -e ''; \ 161 | echo -e '\tOptions -Indexes'; \ 162 | echo -e '\tAllowOverride All'; \ 163 | echo -e ''; \ 164 | } | tee "$APACHE_CONFDIR/conf.d/php.conf" 165 | 166 | # Fix DocumentRoot and PHP module loading 167 | RUN sed -i 's@^DocumentRoot "/var/www/localhost/htdocs"@DocumentRoot "/var/www/html"@' /etc/apache2/httpd.conf \ 168 | && sed -i 's@@@' /etc/apache2/httpd.conf \ 169 | && sed -i 's@LoadModule php5_module lib/apache2/libphp5.so@LoadModule php5_module modules/libphp5.so@' /etc/apache2/httpd.conf 170 | 171 | COPY docker-php-ext-* docker-php-entrypoint /usr/local/bin/ 172 | 173 | ENTRYPOINT ["docker-php-entrypoint"] 174 | COPY apache2-foreground /usr/local/bin/ 175 | COPY httpd.conf /usr/local/etc/httpd.conf.tpl 176 | 177 | WORKDIR /var/www/html 178 | 179 | EXPOSE 80 180 | CMD ["apache2-foreground"] 181 | -------------------------------------------------------------------------------- /apache/httpd.conf: -------------------------------------------------------------------------------- 1 | # 2 | # This is the main Apache HTTP server configuration file. It contains the 3 | # configuration directives that give the server its instructions. 4 | # See for detailed information. 5 | # In particular, see 6 | # 7 | # for a discussion of each configuration directive. 8 | # 9 | # Do NOT simply read the instructions in here without understanding 10 | # what they do. They're here only as hints or reminders. If you are unsure 11 | # consult the online docs. You have been warned. 12 | # 13 | # Configuration and logfile names: If the filenames you specify for many 14 | # of the server's control files begin with "/" (or "drive:/" for Win32), the 15 | # server will use that explicit path. If the filenames do *not* begin 16 | # with "/", the value of ServerRoot is prepended -- so "logs/access_log" 17 | # with ServerRoot set to "/usr/local/apache2" will be interpreted by the 18 | # server as "/usr/local/apache2/logs/access_log", whereas "/logs/access_log" 19 | # will be interpreted as '/logs/access_log'. 20 | 21 | # 22 | # ServerTokens 23 | # This directive configures what you return as the Server HTTP response 24 | # Header. The default is 'Full' which sends information about the OS-Type 25 | # and compiled in modules. 26 | # Set to one of: Full | OS | Minor | Minimal | Major | Prod 27 | # where Full conveys the most information, and Prod the least. 28 | # 29 | ServerTokens OS 30 | 31 | # 32 | # ServerRoot: The top of the directory tree under which the server's 33 | # configuration, error, and log files are kept. 34 | # 35 | # Do not add a slash at the end of the directory path. If you point 36 | # ServerRoot at a non-local disk, be sure to specify a local disk on the 37 | # Mutex directive, if file-based mutexes are used. If you wish to share the 38 | # same ServerRoot for multiple httpd daemons, you will need to change at 39 | # least PidFile. 40 | # 41 | ServerRoot /var/www 42 | 43 | # 44 | # Mutex: Allows you to set the mutex mechanism and mutex file directory 45 | # for individual mutexes, or change the global defaults 46 | # 47 | # Uncomment and change the directory if mutexes are file-based and the default 48 | # mutex file directory is not on a local disk or is not appropriate for some 49 | # other reason. 50 | # 51 | # Mutex default:/run/apache2 52 | 53 | # 54 | # Listen: Allows you to bind Apache to specific IP addresses and/or 55 | # ports, instead of the default. See also the 56 | # directive. 57 | # 58 | # Change this to Listen on specific IP addresses as shown below to 59 | # prevent Apache from glomming onto all bound IP addresses. 60 | # 61 | #Listen 12.34.56.78:80 62 | Listen 0.0.0.0:$PORT 63 | 64 | # 65 | # Dynamic Shared Object (DSO) Support 66 | # 67 | # To be able to use the functionality of a module which was built as a DSO you 68 | # have to place corresponding `LoadModule' lines at this location so the 69 | # directives contained in it are actually available _before_ they are used. 70 | # Statically compiled modules (those listed by `httpd -l') do not need 71 | # to be loaded here. 72 | # 73 | # Example: 74 | # LoadModule foo_module modules/mod_foo.so 75 | # 76 | LoadModule authn_file_module modules/mod_authn_file.so 77 | #LoadModule authn_dbm_module modules/mod_authn_dbm.so 78 | #LoadModule authn_anon_module modules/mod_authn_anon.so 79 | #LoadModule authn_dbd_module modules/mod_authn_dbd.so 80 | #LoadModule authn_socache_module modules/mod_authn_socache.so 81 | LoadModule authn_core_module modules/mod_authn_core.so 82 | LoadModule authz_host_module modules/mod_authz_host.so 83 | LoadModule authz_groupfile_module modules/mod_authz_groupfile.so 84 | LoadModule authz_user_module modules/mod_authz_user.so 85 | #LoadModule authz_dbm_module modules/mod_authz_dbm.so 86 | #LoadModule authz_owner_module modules/mod_authz_owner.so 87 | #LoadModule authz_dbd_module modules/mod_authz_dbd.so 88 | LoadModule authz_core_module modules/mod_authz_core.so 89 | LoadModule access_compat_module modules/mod_access_compat.so 90 | LoadModule auth_basic_module modules/mod_auth_basic.so 91 | #LoadModule auth_form_module modules/mod_auth_form.so 92 | #LoadModule auth_digest_module modules/mod_auth_digest.so 93 | #LoadModule allowmethods_module modules/mod_allowmethods.so 94 | #LoadModule file_cache_module modules/mod_file_cache.so 95 | #LoadModule cache_module modules/mod_cache.so 96 | #LoadModule cache_disk_module modules/mod_cache_disk.so 97 | #LoadModule cache_socache_module modules/mod_cache_socache.so 98 | #LoadModule socache_shmcb_module modules/mod_socache_shmcb.so 99 | #LoadModule socache_dbm_module modules/mod_socache_dbm.so 100 | #LoadModule socache_memcache_module modules/mod_socache_memcache.so 101 | #LoadModule watchdog_module modules/mod_watchdog.so 102 | #LoadModule macro_module modules/mod_macro.so 103 | #LoadModule dbd_module modules/mod_dbd.so 104 | #LoadModule dumpio_module modules/mod_dumpio.so 105 | #LoadModule echo_module modules/mod_echo.so 106 | #LoadModule buffer_module modules/mod_buffer.so 107 | #LoadModule data_module modules/mod_data.so 108 | #LoadModule ratelimit_module modules/mod_ratelimit.so 109 | LoadModule reqtimeout_module modules/mod_reqtimeout.so 110 | #LoadModule ext_filter_module modules/mod_ext_filter.so 111 | #LoadModule request_module modules/mod_request.so 112 | #LoadModule include_module modules/mod_include.so 113 | LoadModule filter_module modules/mod_filter.so 114 | #LoadModule reflector_module modules/mod_reflector.so 115 | #LoadModule substitute_module modules/mod_substitute.so 116 | #LoadModule sed_module modules/mod_sed.so 117 | #LoadModule charset_lite_module modules/mod_charset_lite.so 118 | #LoadModule deflate_module modules/mod_deflate.so 119 | LoadModule mime_module modules/mod_mime.so 120 | LoadModule log_config_module modules/mod_log_config.so 121 | #LoadModule log_debug_module modules/mod_log_debug.so 122 | #LoadModule log_forensic_module modules/mod_log_forensic.so 123 | #LoadModule logio_module modules/mod_logio.so 124 | LoadModule env_module modules/mod_env.so 125 | #LoadModule mime_magic_module modules/mod_mime_magic.so 126 | #LoadModule expires_module modules/mod_expires.so 127 | LoadModule headers_module modules/mod_headers.so 128 | #LoadModule usertrack_module modules/mod_usertrack.so 129 | #LoadModule unique_id_module modules/mod_unique_id.so 130 | LoadModule setenvif_module modules/mod_setenvif.so 131 | LoadModule version_module modules/mod_version.so 132 | #LoadModule remoteip_module modules/mod_remoteip.so 133 | #LoadModule session_module modules/mod_session.so 134 | #LoadModule session_cookie_module modules/mod_session_cookie.so 135 | #LoadModule session_dbd_module modules/mod_session_dbd.so 136 | #LoadModule slotmem_shm_module modules/mod_slotmem_shm.so 137 | #LoadModule slotmem_plain_module modules/mod_slotmem_plain.so 138 | #LoadModule dialup_module modules/mod_dialup.so 139 | #LoadModule mpm_event_module modules/mod_mpm_event.so 140 | LoadModule mpm_prefork_module modules/mod_mpm_prefork.so 141 | #LoadModule mpm_worker_module modules/mod_mpm_worker.so 142 | LoadModule unixd_module modules/mod_unixd.so 143 | #LoadModule heartbeat_module modules/mod_heartbeat.so 144 | #LoadModule heartmonitor_module modules/mod_heartmonitor.so 145 | LoadModule status_module modules/mod_status.so 146 | LoadModule autoindex_module modules/mod_autoindex.so 147 | #LoadModule asis_module modules/mod_asis.so 148 | #LoadModule info_module modules/mod_info.so 149 | #LoadModule suexec_module modules/mod_suexec.so 150 | 151 | #LoadModule cgid_module modules/mod_cgid.so 152 | 153 | 154 | #LoadModule cgi_module modules/mod_cgi.so 155 | 156 | #LoadModule vhost_alias_module modules/mod_vhost_alias.so 157 | #LoadModule negotiation_module modules/mod_negotiation.so 158 | LoadModule dir_module modules/mod_dir.so 159 | #LoadModule actions_module modules/mod_actions.so 160 | #LoadModule speling_module modules/mod_speling.so 161 | #LoadModule userdir_module modules/mod_userdir.so 162 | LoadModule alias_module modules/mod_alias.so 163 | LoadModule rewrite_module modules/mod_rewrite.so 164 | LoadModule remoteip_module modules/mod_remoteip.so 165 | 166 | LoadModule negotiation_module modules/mod_negotiation.so 167 | LoadModule php5_module modules/libphp5.so 168 | 169 | 170 | # 171 | # If you wish httpd to run as a different user or group, you must run 172 | # httpd as root initially and it will switch. 173 | # 174 | # User/Group: The name (or #number) of the user/group to run httpd as. 175 | # It is usually good practice to create a dedicated user and group for 176 | # running httpd, as with most system services. 177 | # 178 | User $APACHE_RUN_USER 179 | Group $APACHE_RUN_GROUP 180 | 181 | 182 | 183 | # 'Main' server configuration 184 | # 185 | # The directives in this section set up the values used by the 'main' 186 | # server, which responds to any requests that aren't handled by a 187 | # definition. These values also provide defaults for 188 | # any containers you may define later in the file. 189 | # 190 | # All of these directives may appear inside containers, 191 | # in which case these default settings will be overridden for the 192 | # virtual host being defined. 193 | # 194 | 195 | # 196 | # ServerAdmin: Your address, where problems with the server should be 197 | # e-mailed. This address appears on some server-generated pages, such 198 | # as error documents. e.g. admin@your-domain.com 199 | # 200 | ServerAdmin you@example.com 201 | 202 | # 203 | # Optionally add a line containing the server version and virtual host 204 | # name to server-generated pages (internal error documents, FTP directory 205 | # listings, mod_status and mod_info output etc., but not CGI generated 206 | # documents or custom error documents). 207 | # Set to "EMail" to also include a mailto: link to the ServerAdmin. 208 | # Set to one of: On | Off | EMail 209 | # 210 | ServerSignature On 211 | 212 | # 213 | # ServerName gives the name and port that the server uses to identify itself. 214 | # This can often be determined automatically, but we recommend you specify 215 | # it explicitly to prevent problems during startup. 216 | # 217 | # If your host doesn't have a registered DNS name, enter its IP address here. 218 | # 219 | #ServerName www.example.com:80 220 | 221 | # 222 | # Deny access to the entirety of your server's filesystem. You must 223 | # explicitly permit access to web content directories in other 224 | # blocks below. 225 | # 226 | 227 | AllowOverride none 228 | Require all denied 229 | 230 | 231 | # 232 | # Note that from this point forward you must specifically allow 233 | # particular features to be enabled - so if something's not working as 234 | # you might expect, make sure that you have specifically enabled it 235 | # below. 236 | # 237 | 238 | # 239 | # DocumentRoot: The directory out of which you will serve your 240 | # documents. By default, all requests are taken from this directory, but 241 | # symbolic links and aliases may be used to point to other locations. 242 | # 243 | DocumentRoot "$APACHE_DOCUMENT_ROOT" 244 | 245 | # 246 | # Possible values for the Options directive are "None", "All", 247 | # or any combination of: 248 | # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews 249 | # 250 | # Note that "MultiViews" must be named *explicitly* --- "Options All" 251 | # doesn't give it to you. 252 | # 253 | # The Options directive is both complicated and important. Please see 254 | # http://httpd.apache.org/docs/2.4/mod/core.html#options 255 | # for more information. 256 | # 257 | Options $DIRECTORY_OPTIONS 258 | 259 | # 260 | # AllowOverride controls what directives may be placed in .htaccess files. 261 | # It can be "All", "None", or any combination of the keywords: 262 | # AllowOverride FileInfo AuthConfig Limit 263 | # 264 | AllowOverride $ALLOW_OVERRIDE 265 | 266 | # 267 | # Controls who can get stuff from this server. 268 | # 269 | Require all granted 270 | 271 | 272 | # 273 | # DirectoryIndex: sets the file that Apache will serve if a directory 274 | # is requested. 275 | # 276 | 277 | DirectoryIndex index.html 278 | 279 | 280 | # 281 | # The following lines prevent .htaccess and .htpasswd files from being 282 | # viewed by Web clients. 283 | # 284 | 285 | Require all denied 286 | 287 | 288 | # 289 | # ErrorLog: The location of the error log file. 290 | # If you do not specify an ErrorLog directive within a 291 | # container, error messages relating to that virtual host will be 292 | # logged here. If you *do* define an error logfile for a 293 | # container, that host's errors will be logged there and not here. 294 | # 295 | ErrorLog logs/error.log 296 | 297 | # 298 | # LogLevel: Control the number of messages logged to the error_log. 299 | # Possible values include: debug, info, notice, warn, error, crit, 300 | # alert, emerg. 301 | # 302 | LogLevel warn 303 | 304 | 305 | # 306 | # The following directives define some format nicknames for use with 307 | # a CustomLog directive (see below). 308 | # 309 | LogFormat "%a %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined 310 | LogFormat "%h %l %u %t \"%r\" %>s %b" common 311 | 312 | 313 | # You need to enable mod_logio.c to use %I and %O 314 | LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\" %I %O" combinedio 315 | 316 | 317 | # 318 | # The location and format of the access logfile (Common Logfile Format). 319 | # If you do not define any access logfiles within a 320 | # container, they will be logged here. Contrariwise, if you *do* 321 | # define per- access logfiles, transactions will be 322 | # logged therein and *not* in this file. 323 | # 324 | #CustomLog logs/access.log common 325 | 326 | # 327 | # If you prefer a logfile with access, agent, and referer information 328 | # (Combined Logfile Format) you can use the following directive. 329 | # 330 | CustomLog logs/access.log combined env=!dontlog 331 | 332 | 333 | 334 | # 335 | # Redirect: Allows you to tell clients about documents that used to 336 | # exist in your server's namespace, but do not anymore. The client 337 | # will make a new request for the document at its new location. 338 | # Example: 339 | # Redirect permanent /foo http://www.example.com/bar 340 | 341 | # 342 | # Alias: Maps web paths into filesystem paths and is used to 343 | # access content that does not live under the DocumentRoot. 344 | # Example: 345 | # Alias /webpath /full/filesystem/path 346 | # 347 | # If you include a trailing / on /webpath then the server will 348 | # require it to be present in the URL. You will also likely 349 | # need to provide a section to allow access to 350 | # the filesystem path. 351 | 352 | # 353 | # ScriptAlias: This controls which directories contain server scripts. 354 | # ScriptAliases are essentially the same as Aliases, except that 355 | # documents in the target directory are treated as applications and 356 | # run by the server when requested rather than as documents sent to the 357 | # client. The same rules about trailing "/" apply to ScriptAlias 358 | # directives as to Alias. 359 | # 360 | ScriptAlias /cgi-bin/ "/var/www/localhost/cgi-bin/" 361 | 362 | 363 | 364 | 365 | # 366 | # ScriptSock: On threaded servers, designate the path to the UNIX 367 | # socket used to communicate with the CGI daemon of mod_cgid. 368 | # 369 | #Scriptsock cgisock 370 | 371 | 372 | # 373 | # "/var/www/localhost/cgi-bin" should be changed to whatever your ScriptAliased 374 | # CGI directory exists, if you have that configured. 375 | # 376 | 377 | AllowOverride None 378 | Options None 379 | Require all granted 380 | 381 | 382 | 383 | # 384 | # TypesConfig points to the file containing the list of mappings from 385 | # filename extension to MIME-type. 386 | # 387 | TypesConfig /etc/apache2/mime.types 388 | 389 | # 390 | # AddType allows you to add to or override the MIME configuration 391 | # file specified in TypesConfig for specific file types. 392 | # 393 | #AddType application/x-gzip .tgz 394 | # 395 | # AddEncoding allows you to have certain browsers uncompress 396 | # information on the fly. Note: Not all browsers support this. 397 | # 398 | #AddEncoding x-compress .Z 399 | #AddEncoding x-gzip .gz .tgz 400 | # 401 | # If the AddEncoding directives above are commented-out, then you 402 | # probably should define those extensions to indicate media types: 403 | # 404 | AddType application/x-compress .Z 405 | AddType application/x-gzip .gz .tgz 406 | 407 | # 408 | # AddHandler allows you to map certain file extensions to "handlers": 409 | # actions unrelated to filetype. These can be either built into the server 410 | # or added with the Action directive (see below) 411 | # 412 | # To use CGI scripts outside of ScriptAliased directories: 413 | # (You will also need to add "ExecCGI" to the "Options" directive.) 414 | # 415 | #AddHandler cgi-script .cgi 416 | 417 | # For type maps (negotiated resources): 418 | #AddHandler type-map var 419 | 420 | # 421 | # Filters allow you to process content before it is sent to the client. 422 | # 423 | # To parse .shtml files for server-side includes (SSI): 424 | # (You will also need to add "Includes" to the "Options" directive.) 425 | # 426 | #AddType text/html .shtml 427 | #AddOutputFilter INCLUDES .shtml 428 | 429 | 430 | # 431 | # The mod_mime_magic module allows the server to use various hints from the 432 | # contents of the file itself to determine its type. The MIMEMagicFile 433 | # directive tells the module where the hint definitions are located. 434 | # 435 | 436 | MIMEMagicFile /etc/apache2/magic 437 | 438 | 439 | # 440 | # Customizable error responses come in three flavors: 441 | # 1) plain text 2) local redirects 3) external redirects 442 | # 443 | # Some examples: 444 | #ErrorDocument 500 "The server made a boo boo." 445 | #ErrorDocument 404 /missing.html 446 | #ErrorDocument 404 "/cgi-bin/missing_handler.pl" 447 | #ErrorDocument 402 http://www.example.com/subscription_info.html 448 | # 449 | 450 | # 451 | # MaxRanges: Maximum number of Ranges in a request before 452 | # returning the entire resource, or one of the special 453 | # values 'default', 'none' or 'unlimited'. 454 | # Default setting is to accept 200 Ranges. 455 | #MaxRanges unlimited 456 | 457 | # 458 | # EnableMMAP and EnableSendfile: On systems that support it, 459 | # memory-mapping or the sendfile syscall may be used to deliver 460 | # files. This usually improves server performance, but must 461 | # be turned off when serving from networked-mounted 462 | # filesystems or if support for these functions is otherwise 463 | # broken on your system. 464 | # Defaults: EnableMMAP On, EnableSendfile Off 465 | # 466 | #EnableMMAP off 467 | #EnableSendfile on 468 | 469 | # Load config files from the config directory "/etc/apache2/conf.d". 470 | # 471 | RemoteIPHeader X-Forwarded-For 472 | 473 | IncludeOptional /etc/apache2/conf.d/*.conf 474 | --------------------------------------------------------------------------------