Roll back CUSTOM root changes and bump PHP 7.3.4

This commit is contained in:
Ric Harvey
2019-04-05 15:06:55 +01:00
parent 3423437665
commit aa2c30a921
7 changed files with 37 additions and 49 deletions

View File

@@ -1,4 +1,4 @@
FROM php:7.3.3-fpm-alpine3.9 FROM php:7.3.4-fpm-alpine3.9
LABEL maintainer="Ric Harvey <ric@ngd.io>" LABEL maintainer="Ric Harvey <ric@ngd.io>"

View File

@@ -1,6 +1,6 @@
![pipeline status](https://gitlab.com/ric_harvey/nginx-php-fpm/badges/master/pipeline.svg) ![pipeline status](https://gitlab.com/ric_harvey/nginx-php-fpm/badges/master/pipeline.svg)
![docker hub](https://img.shields.io/docker/pulls/richarvey/nginx-php-fpm.svg?style=flat) ![docker hub](https://img.shields.io/docker/pulls/richarvey/nginx-php-fpm.svg?style=flat-square)
![docker hub](https://img.shields.io/docker/stars/richarvey/nginx-php-fpm.svg?style=flat) ![docker hub](https://img.shields.io/docker/stars/richarvey/nginx-php-fpm.svg?style=flat-square)
## Overview ## Overview
This is a Dockerfile/image to build a container for nginx and php-fpm, with the ability to pull website code from git when the container is created, as well as allowing the container to push and pull changes to the code to and from git. The container also has the ability to update templated files with variables passed to docker in order to update your code and settings. There is support for lets encrypt SSL configurations, custom nginx configs, core nginx/PHP variable overrides for running preferences, X-Forwarded-For headers and UID mapping for local volume support. This is a Dockerfile/image to build a container for nginx and php-fpm, with the ability to pull website code from git when the container is created, as well as allowing the container to push and pull changes to the code to and from git. The container also has the ability to update templated files with variables passed to docker in order to update your code and settings. There is support for lets encrypt SSL configurations, custom nginx configs, core nginx/PHP variable overrides for running preferences, X-Forwarded-For headers and UID mapping for local volume support.
@@ -10,7 +10,7 @@ If you have improvements or suggestions please open an issue or pull request on
### Versioning ### Versioning
| Docker Tag | Git Release | Nginx Version | PHP Version | Alpine Version | | Docker Tag | Git Release | Nginx Version | PHP Version | Alpine Version |
|-----|-------|-----|--------|--------| |-----|-------|-----|--------|--------|
| latest/1.6.7 | Master Branch |1.14.2 | 7.3.3 | 3.9 | | latest/1.6.8 | Master Branch |1.14.2 | 7.3.4 | 3.9 |
For other tags please see: [versioning](https://gitlab.com/ric_harvey/nginx-php-fpm/blob/master/docs/versioning.md) For other tags please see: [versioning](https://gitlab.com/ric_harvey/nginx-php-fpm/blob/master/docs/versioning.md)

View File

@@ -21,7 +21,6 @@ The following flags are a list of all the currently supported options that can b
| Name | Description | | Name | Description |
|-------------------------|----------------------------------------------------------------------------------------------------------------| |-------------------------|----------------------------------------------------------------------------------------------------------------|
| WEBROOT | Change the default webroot directory from `/var/www/html` to your own setting | | WEBROOT | Change the default webroot directory from `/var/www/html` to your own setting |
| CONFIG_FOLDER | Change the default config directory from `/var/www/html/conf` to your own setting |
| ERRORS | Set to 1 to display PHP Errors in the browser | | ERRORS | Set to 1 to display PHP Errors in the browser |
| HIDE_NGINX_HEADERS | Disable by setting to 0, default behaviour is to hide nginx + php version in headers | | HIDE_NGINX_HEADERS | Disable by setting to 0, default behaviour is to hide nginx + php version in headers |
| PHP_MEM_LIMIT | Set higher PHP memory limit, default is 128 Mb | | PHP_MEM_LIMIT | Set higher PHP memory limit, default is 128 Mb |
@@ -32,7 +31,6 @@ The following flags are a list of all the currently supported options that can b
| REAL_IP_HEADER | set to 1 to enable real ip support in the logs | | REAL_IP_HEADER | set to 1 to enable real ip support in the logs |
| REAL_IP_FROM | set to your CIDR block for real ip in logs | | REAL_IP_FROM | set to your CIDR block for real ip in logs |
| RUN_SCRIPTS | Set to 1 to execute scripts | | RUN_SCRIPTS | Set to 1 to execute scripts |
| SCRIPTS_FOLDER | Change the default script folder from `/var/www/html/scripts` to your won setting |
| PGID | Set to GroupId you want to use for nginx (helps permissions when using local volume) | | PGID | Set to GroupId you want to use for nginx (helps permissions when using local volume) |
| PUID | Set to UserID you want to use for nginx (helps permissions when using local volume) | | PUID | Set to UserID you want to use for nginx (helps permissions when using local volume) |
| REMOVE_FILES | Use REMOVE_FILES=0 to prevent the script from clearing out /var/www/html (useful for working with local files) | | REMOVE_FILES | Use REMOVE_FILES=0 to prevent the script from clearing out /var/www/html (useful for working with local files) |

View File

@@ -1,6 +1,5 @@
## Custom Nginx Config files ## Custom Nginx Config files
Sometimes you need a custom config file for nginx to do rewrites or password protection, etc. For this reason we've included the ability to have custom nginx configs pulled directly from your git source. Please have a read of the [repo layout guidelines](repo_layout.md) for more information. Its pretty simple to enable this, all you need to do is include a folder in the root of your repository called ```conf/nginx/``` within this folder you need to include a file called ```nginx-site.conf``` which will contain your default nginx site config. If you wish to have a custom file for SSL you simply include a file called ```nginx-site-ssl.conf``` in the same directory. These files will then be swapped in after you code is cloned. Sometimes you need a custom config file for nginx to do rewrites or password protection, etc. For this reason we've included the ability to have custom nginx configs pulled directly from your git source. Please have a read of the [repo layout guidelines](repo_layout.md) for more information. Its pretty simple to enable this, all you need to do is include a folder in the root of your repository called ```conf/nginx/``` within this folder you need to include a file called ```nginx-site.conf``` which will contain your default nginx site config. If you wish to have a custom file for SSL you simply include a file called ```nginx-site-ssl.conf``` in the same directory. These files will then be swapped in after you code is cloned.
In addition, you can configure __CONFIG_FOLDER__ with your custome path.
## REAL IP / X-Forwarded-For Headers ## REAL IP / X-Forwarded-For Headers
If you operate your container behind a load balancer, an ELB on AWS for example, you need to configure nginx to get the real IP and not the load balancer IP in the logs by using the X-Forwarded-For. We've provided some handy flags to let you do this. You need to set both of these to get this to work: If you operate your container behind a load balancer, an ELB on AWS for example, you need to configure nginx to get the real IP and not the load balancer IP in the logs by using the X-Forwarded-For. We've provided some handy flags to let you do this. You need to set both of these to get this to work:

View File

@@ -1,6 +1,5 @@
## Scripting ## Scripting
There is often an occasion where you need to run a script on code to do a transformation once code lands in the container. For this reason we have developed scripting support. By including a scripts folder in your git repository and passing the __RUN_SCRIPTS=1__ flag to your command line the container will execute your scripts. Please see the [repo layout guidelines](https://gitlab.com/ric_harvey/nginx-php-fpm/blob/master/docs/repo_layout.md) for more details on how to organise this. There is often an occasion where you need to run a script on code to do a transformation once code lands in the container. For this reason we have developed scripting support. By including a scripts folder in your git repository and passing the __RUN_SCRIPTS=1__ flag to your command line the container will execute your scripts. Please see the [repo layout guidelines](https://gitlab.com/ric_harvey/nginx-php-fpm/blob/master/docs/repo_layout.md) for more details on how to organise this.
In addition, you can configure __SCRIPT_FOLDER__ with your custome path.
## Using environment variables / templating ## Using environment variables / templating
To set the variables pass them in as environment variables on the docker command line. To set the variables pass them in as environment variables on the docker command line.

View File

@@ -15,17 +15,21 @@ The latest tag will always follow the master branch in git. the other versions w
#### PHP 7.3 #### PHP 7.3
| Docker Tag | PHP Version | Nginx Version | Alpine Version | Container Scripts | | Docker Tag | PHP Version | Nginx Version | Alpine Version | Container Scripts | Notes |
|-----|-------|-----|--------|--------| |-----|-------|-----|--------|--------|----------|
| 1.6.0 | 7.3.2 |1.14.2 | 3.9 | 0.3.8 | | 1.6.0 | 7.3.2 |1.14.2 | 3.9 | 0.3.8 ||
| 1.6.1 | 7.3.2 |1.14.2 | 3.9 | 0.3.9 | | 1.6.1 | 7.3.2 |1.14.2 | 3.9 | 0.3.9 ||
| 1.6.2 | 7.3.3 |1.14.2 | 3.9 | 0.3.10 | | 1.6.2 | 7.3.3 |1.14.2 | 3.9 | 0.3.10 ||
| 1.6.3 | 7.3.3 |1.14.2 | 3.9 | 0.3.11 | | 1.6.3 | 7.3.3 |1.14.2 | 3.9 | 0.3.11 ||
| 1.6.4 | 7.3.3 |1.14.2 | 3.9 | 0.3.12 | | 1.6.4 | 7.3.3 |1.14.2 | 3.9 | 0.3.12 ||
| 1.6.5 | 7.3.3 |1.14.2 | 3.9 | 0.3.12 | | 1.6.5 | 7.3.3 |1.14.2 | 3.9 | 0.3.12 ||
| 1.6.6 | 7.3.3 |1.14.2 | 3.9 | 0.3.12 | | 1.6.6 | 7.3.3 |1.14.2 | 3.9 | 0.3.12 ||
| 1.6.7 | 7.3.3 |1.14.2 | 3.9 | 0.3.13 | | 1.6.7 | 7.3.3 |1.14.2 | 3.9 | 0.3.13 | Broken |
| 1.6.8 | 7.3.4 |1.14.2 | 3.9 | 0.3.12 | Custom scripts rolled back |
These tags will be created on GitLab and as tags in docker hub.
### Unmaintained tags:
#### PHP 7.2 #### PHP 7.2
| Docker Tag | PHP Version | Nginx Version | Alpine Version | Container Scripts | | Docker Tag | PHP Version | Nginx Version | Alpine Version | Container Scripts |
@@ -41,9 +45,6 @@ The latest tag will always follow the master branch in git. the other versions w
| 1.5.6 | 7.2.9 |1.14.0 | 3.7 | 0.3.8 | | 1.5.6 | 7.2.9 |1.14.0 | 3.7 | 0.3.8 |
| 1.5.7 | 7.2.10 |1.14.0 | 3.7 | 0.3.8 | | 1.5.7 | 7.2.10 |1.14.0 | 3.7 | 0.3.8 |
These tags will be created on GitLab and as tags in docker hub.
### Unmaintained tags:
#### PHP 7.1 #### PHP 7.1
| Docker Tag | Git Release | Nginx Version | PHP Version | Alpine Version | Container Scripts | | Docker Tag | Git Release | Nginx Version | PHP Version | Alpine Version | Container Scripts |

View File

@@ -21,7 +21,7 @@ fi
if [ ! -z "$WEBROOT" ]; then if [ ! -z "$WEBROOT" ]; then
sed -i "s#root /var/www/html;#root ${WEBROOT};#g" /etc/nginx/sites-available/default.conf sed -i "s#root /var/www/html;#root ${WEBROOT};#g" /etc/nginx/sites-available/default.conf
else else
WEBROOT=/var/www/html webroot=/var/www/html
fi fi
# Setup git variables # Setup git variables
@@ -34,14 +34,14 @@ if [ ! -z "$GIT_NAME" ]; then
fi fi
# Dont pull code down if the .git folder exists # Dont pull code down if the .git folder exists
if [ ! -d "${WEBROOT}/.git" ]; then if [ ! -d "/var/www/html/.git" ]; then
# Pull down code from git for our site! # Pull down code from git for our site!
if [ ! -z "$GIT_REPO" ]; then if [ ! -z "$GIT_REPO" ]; then
# Remove the test index file if you are pulling in a git repo # Remove the test index file if you are pulling in a git repo
if [ ! -z ${REMOVE_FILES} ] && [ ${REMOVE_FILES} == 0 ]; then if [ ! -z ${REMOVE_FILES} ] && [ ${REMOVE_FILES} == 0 ]; then
echo "skiping removal of files" echo "skiping removal of files"
else else
rm -Rf ${WEBROOT}/* rm -Rf /var/www/html/*
fi fi
GIT_COMMAND='git clone ' GIT_COMMAND='git clone '
if [ ! -z "$GIT_BRANCH" ]; then if [ ! -z "$GIT_BRANCH" ]; then
@@ -57,7 +57,7 @@ if [ ! -d "${WEBROOT}/.git" ]; then
GIT_COMMAND=${GIT_COMMAND}" https://${GIT_USERNAME}:${GIT_PERSONAL_TOKEN}@${GIT_REPO}" GIT_COMMAND=${GIT_COMMAND}" https://${GIT_USERNAME}:${GIT_PERSONAL_TOKEN}@${GIT_REPO}"
fi fi
fi fi
${GIT_COMMAND} ${WEBROOT} || exit 1 ${GIT_COMMAND} /var/www/html || exit 1
if [ ! -z "$GIT_TAG" ]; then if [ ! -z "$GIT_TAG" ]; then
git checkout ${GIT_TAG} || exit 1 git checkout ${GIT_TAG} || exit 1
fi fi
@@ -65,26 +65,22 @@ if [ ! -d "${WEBROOT}/.git" ]; then
git checkout ${GIT_COMMIT} || exit 1 git checkout ${GIT_COMMIT} || exit 1
fi fi
if [ -z "$SKIP_CHOWN" ]; then if [ -z "$SKIP_CHOWN" ]; then
chown -Rf nginx.nginx ${WEBROOT} chown -Rf nginx.nginx /var/www/html
fi fi
fi fi
fi fi
if [ -z "$CONFIG_FOLDER" ]; then
CONFIG_FOLDER=${WEBROOT}/conf
fi
# Enable custom nginx config files if they exist # Enable custom nginx config files if they exist
if [ -f ${CONFIG_FOLDER}/nginx.conf ]; then if [ -f /var/www/html/conf/nginx/nginx.conf ]; then
cp ${CONFIG_FOLDER}/nginx.conf /etc/nginx/nginx.conf cp /var/www/html/conf/nginx/nginx.conf /etc/nginx/nginx.conf
fi fi
if [ -f ${CONFIG_FOLDER}/nginx-site.conf ]; then if [ -f /var/www/html/conf/nginx/nginx-site.conf ]; then
cp ${CONFIG_FOLDER}/nginx-site.conf /etc/nginx/sites-available/default.conf cp /var/www/html/conf/nginx/nginx-site.conf /etc/nginx/sites-available/default.conf
fi fi
if [ -f ${CONFIG_FOLDER}/nginx-site-ssl.conf ]; then if [ -f /var/www/html/conf/nginx/nginx-site-ssl.conf ]; then
cp ${CONFIG_FOLDER}/nginx-site-ssl.conf /etc/nginx/sites-available/default-ssl.conf cp /var/www/html/conf/nginx/nginx-site-ssl.conf /etc/nginx/sites-available/default-ssl.conf
fi fi
@@ -193,22 +189,17 @@ if [ ! -z "$PUID" ]; then
adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx -u ${PUID} nginx adduser -D -S -h /var/cache/nginx -s /sbin/nologin -G nginx -u ${PUID} nginx
else else
if [ -z "$SKIP_CHOWN" ]; then if [ -z "$SKIP_CHOWN" ]; then
chown -Rf nginx.nginx ${WEBROOT} chown -Rf nginx.nginx /var/www/html
fi fi
fi fi
# Run custom scripts # Run custom scripts
if [[ "$RUN_SCRIPTS" == "1" ]] ; then if [[ "$RUN_SCRIPTS" == "1" ]] ; then
if [ -d "/var/www/html/scripts/" ]; then
if [ -z "$SCRIPTS_FOLDER" ]; then
SCRIPTS_FOLDER=${WEBROOT}/scripts/
fi
if [ -d "${SCRIPTS_FOLDER}" ]; then
# make scripts executable incase they aren't # make scripts executable incase they aren't
chmod -Rf 750 ${SCRIPTS_FOLDER}/*; sync; chmod -Rf 750 /var/www/html/scripts/*; sync;
# run scripts in number order # run scripts in number order
for i in `ls ${SCRIPTS_FOLDER}/`; do ${SCRIPTS_FOLDER}/$i ; done for i in `ls /var/www/html/scripts/`; do /var/www/html/scripts/$i ; done
else else
echo "Can't find script directory" echo "Can't find script directory"
fi fi
@@ -216,13 +207,13 @@ fi
if [ -z "$SKIP_COMPOSER" ]; then if [ -z "$SKIP_COMPOSER" ]; then
# Try auto install for composer # Try auto install for composer
if [ -f "${WEBROOT}/composer.lock" ]; then if [ -f "/var/www/html/composer.lock" ]; then
if [ "$APPLICATION_ENV" == "development" ]; then if [ "$APPLICATION_ENV" == "development" ]; then
composer global require hirak/prestissimo composer global require hirak/prestissimo
composer install --working-dir=${WEBROOT} composer install --working-dir=/var/www/html
else else
composer global require hirak/prestissimo composer global require hirak/prestissimo
composer install --no-dev --working-dir=${WEBROOT} composer install --no-dev --working-dir=/var/www/html
fi fi
fi fi
fi fi