Updated to support custom module install and switch template off by default

This commit is contained in:
Ric Harvey
2016-02-27 19:15:59 +00:00
parent 5a4ecbcf35
commit 3ec76e00ba
3 changed files with 19 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
FROM ubuntu:14.04.3 FROM ubuntu:14.04.4
MAINTAINER Ric Harvey <ric@ngineered.co.uk> MAINTAINER Ric Harvey <ric@ngineered.co.uk>
# Surpress Upstart errors/warning # Surpress Upstart errors/warning

View File

@@ -7,9 +7,9 @@ If you have any improvements please submit a pull request.
### Docker hub repository ### Docker hub repository
The Docker hub build can be found here: [https://registry.hub.docker.com/u/richarvey/nginx-php-fpm/](https://registry.hub.docker.com/u/richarvey/nginx-php-fpm/) The Docker hub build can be found here: [https://registry.hub.docker.com/u/richarvey/nginx-php-fpm/](https://registry.hub.docker.com/u/richarvey/nginx-php-fpm/)
## Versions ## Versions
- Nginx Mainline Version: **1.9.9** - Nginx Mainline Version: **1.9.12**
- PHP: **5.5.9+dfsg-1ubuntu4.14** - PHP: **5.5.9-1ubuntu4.14**
- Ubuntu Trusty: **14.04.03** - Ubuntu Trusty: **14.04.4**
## Building from source ## Building from source
To build from source you need to clone the git repo and run docker build: To build from source you need to clone the git repo and run docker build:
@@ -91,6 +91,11 @@ In order to refresh the code in a container and pull newer code form git simply
``` ```
sudo docker exec -t -i <CONTAINER_NAME> /usr/bin/pull sudo docker exec -t -i <CONTAINER_NAME> /usr/bin/pull
``` ```
### Install Extra Modules
If you wish to install extras at boot time, such as extra php modules you can specify this by adding the DEBS flag, to add multiple packages you need to space separate the values:
```
sudo docker run --name nginx -e 'DEBS=php5-mongo php-json" -p 8080:80 -d richarvey/nginx-php-fpm
```
### Templating ### Templating
This container will automatically configure your web application if you template your code. For example if you are linking to MySQL like above, and you have a config.php file where you need to set the MySQL details include $$_MYSQL_ENV_MYSQL_DATABASE_$$ style template tags. This container will automatically configure your web application if you template your code. For example if you are linking to MySQL like above, and you have a config.php file where you need to set the MySQL details include $$_MYSQL_ENV_MYSQL_DATABASE_$$ style template tags.
@@ -125,10 +130,10 @@ database_pass = $$_MYSQL_PASS_$$
... ...
?> ?>
``` ```
### Skip Templating ### Enable Templating
In order to speed up install time if templating is not required and you have a lot of files in your web root that you don't wish to be scanned, simply include the flag below: In order to speed up boot time templating is now diabled by default, if you wish to enable it simply include the flag below:
``` ```
-e TEMPLATE_NGINX_HTML=0 -e TEMPLATE_NGINX_HTML=1
``` ```
### Template anything ### Template anything
Yes ***ANYTHING***, any variable exposed by a linked container or the **-e** flag lets you template your configuration files. This means you can add redis, mariaDB, memcache or anything you want to your application very easily. Yes ***ANYTHING***, any variable exposed by a linked container or the **-e** flag lets you template your configuration files. This means you can add redis, mariaDB, memcache or anything you want to your application very easily.

View File

@@ -14,6 +14,12 @@ if [ ! -z "$GIT_NAME" ]; then
git config --global push.default simple git config --global push.default simple
fi fi
# Install Extras
if [ ! -z "$DEBS" ]; then
apt-get update
apt-get install -y $DEBS
fi
# Pull down code form git for our site! # Pull down code form git for our site!
if [ ! -z "$GIT_REPO" ]; then if [ ! -z "$GIT_REPO" ]; then
rm /usr/share/nginx/html/* rm /usr/share/nginx/html/*
@@ -37,7 +43,7 @@ procs=$(cat /proc/cpuinfo |grep processor | wc -l)
sed -i -e "s/worker_processes 5/worker_processes $procs/" /etc/nginx/nginx.conf sed -i -e "s/worker_processes 5/worker_processes $procs/" /etc/nginx/nginx.conf
# Very dirty hack to replace variables in code with ENVIRONMENT values # Very dirty hack to replace variables in code with ENVIRONMENT values
if [[ "$TEMPLATE_NGINX_HTML" != "0" ]] ; then if [[ "$TEMPLATE_NGINX_HTML" == "1" ]] ; then
for i in $(env) for i in $(env)
do do
variable=$(echo "$i" | cut -d'=' -f1) variable=$(echo "$i" | cut -d'=' -f1)