Updated to alpine linux

This commit is contained in:
Ric Harvey
2016-06-15 15:36:42 +01:00
parent 16abc13dae
commit 9e216a395f
11 changed files with 968 additions and 176 deletions

View File

@@ -10,5 +10,5 @@ if [ -z "$GIT_NAME" ]; then
exit
fi
cd /usr/share/nginx/html
cd /var/www/html
git pull

View File

@@ -15,7 +15,7 @@ if [ -z "$GIT_NAME" ]; then
fi
ts=$(timestamp)
cd /usr/share/nginx/html
cd /var/www/html
git add *
git commit -a -m "push from container $ts"
git push

View File

@@ -5,6 +5,12 @@
mkdir -p -m 0700 /root/.ssh
echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
if [ ! -z "$SSH_KEY" ]; then
echo $SSH_KEY > /root/.ssh/id_rsa.base64
base64 -d /root/.ssh/id_rsa.base64 > /root/.ssh/id_rsa
chmod 600 /root/.ssh/id_rsa
fi
# Setup git variables
if [ ! -z "$GIT_EMAIL" ]; then
git config --global user.email "$GIT_EMAIL"
@@ -14,34 +20,23 @@ if [ ! -z "$GIT_NAME" ]; then
git config --global push.default simple
fi
# Install Extras
if [ ! -z "$DEBS" ]; then
apt-get update
apt-get install -y $DEBS
fi
# Pull down code form git for our site!
if [ ! -z "$GIT_REPO" ]; then
rm /usr/share/nginx/html/*
rm /var/www/html/*
if [ ! -z "$GIT_BRANCH" ]; then
git clone -b $GIT_BRANCH $GIT_REPO /usr/share/nginx/html/
git clone -b $GIT_BRANCH $GIT_REPO /var/www/html/
else
git clone $GIT_REPO /usr/share/nginx/html/
git clone $GIT_REPO /var/www/html/
fi
chown -Rf nginx.nginx /usr/share/nginx/*
fi
# Display PHP error's or not
if [[ "$ERRORS" != "1" ]] ; then
sed -i -e "s/error_reporting =.*=/error_reporting = E_ALL/g" /etc/php5/fpm/php.ini
sed -i -e "s/display_errors =.*/display_errors = On/g" /etc/php5/fpm/php.ini
php_flag[display_errors] = off >> /etc/php5/php-fpm.conf
else
echo php_flag[display_errors] = on >> /etc/php5/php-fpm.conf
fi
# Tweak nginx to match the workers to cpu's
procs=$(cat /proc/cpuinfo |grep processor | wc -l)
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
if [[ "$TEMPLATE_NGINX_HTML" == "1" ]] ; then
for i in $(env)
@@ -50,13 +45,10 @@ if [[ "$TEMPLATE_NGINX_HTML" == "1" ]] ; then
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' {} \;
find /var/www/html -type f -exec sed -i -e 's/'${replace}'/'${value}'/g' {} \;
fi
done
fi
# Again set the right permissions (needed when mounting from a volume)
chown -Rf www-data.www-data /usr/share/nginx/html/
# Start supervisord and services
/usr/bin/supervisord -n -c /etc/supervisord.conf