Switching master to PHP7

This commit is contained in:
Ric Harvey
2017-01-03 09:19:57 +00:00
parent 024ece2ce3
commit bc75013ac4
8 changed files with 73 additions and 64 deletions

View File

@@ -4,11 +4,15 @@ All notable changes to this project will be documented in this file.
## [Unreleased]
### Added
## [0.1.2] - 2016-7-13
## [0.2.1] - 2016-7-13
### Added
- Added options to set PHP values @richarvey
- Added default to hide nginx and php version with overrride @richarvey
## [0.2.0] - 2016-6-15
### Added
- updated to php7 @richarvey
## [0.1.1] - 2016-6-15
### Added
- Added php5-gd, php5-intl, php5-memcache, php5-sqlite3, php5-pgsql, php5-xml, php5-xsl @richarvey

View File

@@ -2,48 +2,50 @@ FROM nginx:mainline-alpine
MAINTAINER ngineered <support@ngineered.co.uk>
ENV php_conf /etc/php5/php.ini
ENV fpm_conf /etc/php5/php-fpm.conf
ENV composer_hash aa96f26c2b67226a324c27919f1eb05f21c248b987e6195cad9690d5c1ff713d53020a02ac8c217dbf90a7eacc9d141d
ENV php_conf /etc/php7/php.ini
ENV fpm_conf /etc/php7/php-fpm.d/www.conf
ENV composer_hash 61069fe8c6436a4468d0371454cf38a812e451a14ab1691543f25a9627b97ff96d8753d92a00654c21e2212a5ae1ff36
#RUN echo @edge http://nl.alpinelinux.org/alpine/edge/main >> /etc/apk/repositories && \
RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repositories && \
sed -i -e "s/v3.4/edge/" /etc/apk/repositories && \
echo /etc/apk/respositories && \
apk update && \
apk add --no-cache bash \
openssh-client \
wget \
nginx \
supervisor \
curl \
git \
php5-fpm \
php5-pdo \
php5-pdo_mysql \
php5-mysql \
php5-mysqli \
php5-mcrypt \
php5-ctype \
php5-zlib \
php5-gd \
php5-exif \
php5-intl \
php5-memcache \
php5-sqlite3 \
php5-pgsql \
php5-xml \
php5-xsl \
php5-curl \
php5-openssl \
php5-iconv \
php5-json \
php5-phar \
php5-soap \
php5-dom \
php5-zip \
php5-redis@testing \
php7-fpm \
php7-pdo \
php7-pdo_mysql \
php7-mysqlnd \
php7-mysqli \
php7-mcrypt \
php7-mbstring \
php7-ctype \
php7-zlib \
php7-gd \
php7-exif \
php7-intl \
php7-sqlite3 \
php7-pdo_pgsql \
php7-pgsql \
php7-xml \
php7-xsl \
php7-curl \
php7-openssl \
php7-iconv \
php7-json \
php7-phar \
php7-soap \
php7-dom \
php7-zip \
php7-session \
python \
python-dev \
py-pip \
py2-pip \
augeas-dev \
openssl-dev \
ca-certificates \
@@ -56,16 +58,15 @@ RUN echo @testing http://nl.alpinelinux.org/alpine/edge/testing >> /etc/apk/repo
mkdir -p /var/www/app && \
mkdir -p /run/nginx && \
mkdir -p /var/log/supervisor && \
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php -r "if (hash_file('SHA384', 'composer-setup.php') === '${composer_hash}') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php composer-setup.php --install-dir=/usr/bin --filename=composer && \
php -r "unlink('composer-setup.php');" && \
php7 -r "copy('https://getcomposer.org/installer', 'composer-setup.php');" && \
php7 -r "if (hash_file('SHA384', 'composer-setup.php') === '${composer_hash}') { echo 'Installer verified'; } else { echo 'Installer corrupt'; unlink('composer-setup.php'); } echo PHP_EOL;" && \
php7 composer-setup.php --install-dir=/usr/bin --filename=composer && \
php7 -r "unlink('composer-setup.php');" && \
pip install -U pip && \
pip install -U certbot && \
mkdir -p /etc/letsencrypt/webrootauth && \
apk del gcc musl-dev linux-headers libffi-dev augeas-dev python-dev
ADD conf/supervisord.conf /etc/supervisord.conf
# Copy our nginx config
@@ -105,8 +106,9 @@ RUN sed -i \
-e "s/listen = 127.0.0.1:9000/listen = \/var\/run\/php-fpm.sock/g" \
-e "s/^;clear_env = no$/clear_env = no/" \
${fpm_conf} && \
ln -s /etc/php5/php.ini /etc/php5/conf.d/php.ini && \
find /etc/php5/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;
ln -s /etc/php7/php.ini /etc/php7/conf.d/php.ini && \
find /etc/php7/conf.d/ -name "*.ini" -exec sed -i -re 's/^(\s*)#(.*)/\1;\2/g' {} \;
# Add Scripts
ADD scripts/start.sh /start.sh
@@ -118,7 +120,7 @@ RUN chmod 755 /usr/bin/pull && chmod 755 /usr/bin/push && chmod 755 /usr/bin/let
# copy in code
ADD src/ /var/www/html/
ADD errors/ /var/www/errors/
ADD errors/ /var/www/errors
VOLUME /var/www/html

View File

@@ -10,9 +10,11 @@ The Docker hub build can be found here: [https://registry.hub.docker.com/u/richa
## Versions
| Tag | Nginx | PHP | Alpine |
|-----|-------|-----|--------|
| latest | 1.11.5 | 5.6.27 | 3.4 |
| latest | 1.11.5 | 7.0.14 | 3.4@edge |
| php7 | 1.11.5 | 7.0.14 | 3.4@edge |
| php5 | 1.11.5 | 5.6.27 | 3.4 |
| php7 | 1.11.5 | 7.0.12 | 3.4 |
**PLEASE NOTE: PHP7 is now the default**
## Building from source
To build from source you need to clone the git repo and run docker build:

View File

@@ -16,7 +16,7 @@ events {
http {
include mime.types;
default_type application/octet-stream;
disable_symlinks off;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
@@ -29,6 +29,7 @@ http {
#keepalive_timeout 0;
keepalive_timeout 2;
client_max_body_size 100m;
server_tokens off;
#gzip on;

View File

@@ -21,8 +21,8 @@ supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface
[supervisorctl]
serverurl=unix:///dev/shm/supervisor.sock ; use a unix:// URL for a unix socket
[program:php-fpm]
command = /usr/bin/php-fpm -c /etc/php
[program:php-fpm7]
command = /usr/sbin/php-fpm7 --nodaemonize --fpm-config /etc/php7/php-fpm.d/www.conf
autostart=true
autorestart=true
priority=5

View File

@@ -62,31 +62,31 @@ fi
# Display PHP error's or not
if [[ "$ERRORS" != "1" ]] ; then
echo php_flag[display_errors] = off >> /etc/php5/php-fpm.conf
echo php_flag[display_errors] = off >> /etc/php7/php-fpm.conf
else
echo php_flag[display_errors] = on >> /etc/php5/php-fpm.conf
echo php_flag[display_errors] = on >> /etc/php7/php-fpm.conf
fi
# Display Version Details or not
if [[ "$HIDE_NGINX_HEADERS" == "0" ]] ; then
sed -i "s/server_tokens off;/server_tokens on;/g" /etc/nginx/nginx.conf
else
sed -i "s/expose_php = On/expose_php = Off/g" /etc/php5/conf.d/php.ini
sed -i "s/expose_php = On/expose_php = Off/g" /etc/php7/conf.d/php.ini
fi
# Increase the memory_limit
if [ ! -z "$PHP_MEM_LIMIT" ]; then
sed -i "s/memory_limit = 128M/memory_limit = ${PHP_MEM_LIMIT}M/g" /etc/php5/conf.d/php.ini
sed -i "s/memory_limit = 128M/memory_limit = ${PHP_MEM_LIMIT}M/g" /etc/php7/conf.d/php.ini
fi
# Increase the post_max_size
if [ ! -z "$PHP_POST_MAX_SIZE" ]; then
sed -i "s/post_max_size = 100M/post_max_size = ${PHP_POST_MAX_SIZE}M/g" /etc/php5/conf.d/php.ini
sed -i "s/post_max_size = 100M/post_max_size = ${PHP_POST_MAX_SIZE}M/g" /etc/php7/conf.d/php.ini
fi
# Increase the upload_max_filesize
if [ ! -z "$PHP_UPLOAD_MAX_FILESIZE" ]; then
sed -i "s/upload_max_filesize = 100M/upload_max_filesize= ${PHP_UPLOAD_MAX_FILESIZE}M/g" /etc/php5/conf.d/php.ini
sed -i "s/upload_max_filesize = 100M/upload_max_filesize= ${PHP_UPLOAD_MAX_FILESIZE}M/g" /etc/php7/conf.d/php.ini
fi
# Always chown webroot for better mounting