adding scripts to populate ENV data into code
This commit is contained in:
@@ -11,15 +11,15 @@ ENV DEBIAN_FRONTEND noninteractive
|
|||||||
# Add sources for latest nginx
|
# Add sources for latest nginx
|
||||||
RUN apt-get install -y wget
|
RUN apt-get install -y wget
|
||||||
RUN wget -q http://nginx.org/keys/nginx_signing.key -O- | sudo apt-key add -
|
RUN wget -q http://nginx.org/keys/nginx_signing.key -O- | sudo apt-key add -
|
||||||
RUN echo deb http://nginx.org/packages/ubuntu/ trusty nginx >> /etc/apt/sources.list
|
RUN echo deb http://nginx.org/packages/mainline/ubuntu/ trusty nginx >> /etc/apt/sources.list
|
||||||
RUN echo deb-src http://nginx.org/packages/ubuntu/ trusty nginx >> /etc/apt/sources.list
|
RUN echo deb-src http://nginx.org/packages/mainline/ubuntu/ trusty nginx >> /etc/apt/sources.list
|
||||||
|
|
||||||
# Update System
|
# Update System
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
RUN apt-get -y upgrade
|
RUN apt-get -y upgrade
|
||||||
|
|
||||||
# Basic Requirements
|
# Basic Requirements
|
||||||
RUN apt-get -y install nginx php5-fpm php5-mysql php-apc pwgen python-setuptools curl git unzip
|
RUN apt-get -y install nginx php5-fpm php5-mysql php-apc pwgen python-setuptools curl git unzip vim
|
||||||
|
|
||||||
# Install Extra PHP Modules
|
# Install Extra PHP Modules
|
||||||
RUN apt-get -y install php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-xsl
|
RUN apt-get -y install php5-curl php5-gd php5-intl php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-ming php5-ps php5-pspell php5-recode php5-sqlite php5-tidy php5-xmlrpc php5-xsl
|
||||||
|
|||||||
@@ -33,14 +33,17 @@ server {
|
|||||||
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
fastcgi_split_path_info ^(.+\.php)(/.+)$;
|
||||||
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
fastcgi_pass unix:/var/run/php5-fpm.sock;
|
||||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||||
|
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
|
||||||
fastcgi_index index.php;
|
fastcgi_index index.php;
|
||||||
include fastcgi_params;
|
include fastcgi_params;
|
||||||
}
|
}
|
||||||
|
|
||||||
# deny access to .htaccess files, if Apache's document root
|
# deny access to . files, for security
|
||||||
# concurs with nginx's one
|
|
||||||
#
|
#
|
||||||
location ~ /\.ht {
|
location ~ /\. {
|
||||||
|
access_log off;
|
||||||
|
log_not_found off;
|
||||||
deny all;
|
deny all;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
23
start.sh
23
start.sh
@@ -1,4 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# start supervisord
|
# Pull down code form git for our site!
|
||||||
|
if [ ! -z "$GIT_REPO" ]; then
|
||||||
|
rm /usr/share/nginx/html/*
|
||||||
|
if [ ! -z "$GIT_BRANCH" ]; then
|
||||||
|
git clone -b $GIT_BRANCH $GIT_REPO /usr/share/nginx/html/
|
||||||
|
else
|
||||||
|
git clone $GIT_REPO /usr/share/nginx/html/
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Very dirty hack to replace variables in code with ENVIRONMENT values
|
||||||
|
|
||||||
|
for i in $(env)
|
||||||
|
do
|
||||||
|
variable=$(echo "$i" | cut -d'=' -f1)
|
||||||
|
value=$(echo "$i" | cut -d'=' -f2)
|
||||||
|
if [[ "$variable" != '%s' ]] ; then
|
||||||
|
replace='\$\$_'${variable}'_\$\$'
|
||||||
|
find /usr/share/nginx/html -type f -exec sed -i -e 's/'${replace}'/'${value}'/g' {} \; ; fi
|
||||||
|
done
|
||||||
|
|
||||||
|
# Start supervisord and services
|
||||||
/usr/local/bin/supervisord -n
|
/usr/local/bin/supervisord -n
|
||||||
|
|||||||
Reference in New Issue
Block a user