Beta test of pull and push scripts

This commit is contained in:
Ric Harvey
2015-06-25 10:23:06 +00:00
parent b13602c7e7
commit b525568b72
4 changed files with 52 additions and 0 deletions

View File

@@ -63,6 +63,12 @@ RUN ln -s /etc/nginx/sites-available/default.conf /etc/nginx/sites-enabled/defau
ADD ./index.php /usr/share/nginx/html/index.php
RUN chown -Rf nginx.nginx /usr/share/nginx/html/
# Add git commands to allow container updating
ADD ./pull /usr/bin/pull
ADD ./push /usr/bin/push
RUN chmod 755 /usr/bin/pull
RUN chmod 755 /usr/bin/push
# Supervisor Config
RUN /usr/bin/easy_install supervisor
RUN /usr/bin/easy_install supervisor-stdout

18
pull Executable file
View File

@@ -0,0 +1,18 @@
#!/bin/bash
if [ -z "$GIT_EMAILi2" ]; then
echo "You need to pass the \$GIT_EMAIL variable to the container for this to work"
exit
else
echo $GIT_EMAIL
fi
if [ -z "$GIT_NAME" ]; then
echo "You need to pass the \$GIT_NAME variable to the container for this to work"
exit
else
echo $GIT_NAME
fi
cd /usr/share/nginx/html
git pull

20
push Executable file
View File

@@ -0,0 +1,20 @@
#!/bin/bash
timestamp() {
date +"%D %T"
}
if [ -z "$GIT_EMAIL" ]; then
echo "You need to pass the \$GIT_EMAIL variable to the container for this to work"
exit
fi
if [ -z "$GIT_NAME" ]; then
echo "You need to pass the \$GIT_NAME variable to the container for this to work"
exit
fi
ts=$(timestamp)
cd /usr/share/nginx/html
git add *
git commit -a -m "push from container $ts"

View File

@@ -5,6 +5,14 @@
mkdir -p -m 0700 /root/.ssh
echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config
# Setup git variables
if [ ! -z "$GIT_EMAIL" ]; then
git config --global user.email "$GIT_EMAIL"
fi
if [ ! -z "$GIT_NAME" ]; then
git config --global user.name "$GIT_NAME"
fi
# Pull down code form git for our site!
if [ ! -z "$GIT_REPO" ]; then
rm /usr/share/nginx/html/*