Merge branch 'master' into stable

This commit is contained in:
Ric Harvey
2015-06-25 13:17:19 +00:00
5 changed files with 60 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 ADD ./index.php /usr/share/nginx/html/index.php
RUN chown -Rf nginx.nginx /usr/share/nginx/html/ 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 # Supervisor Config
RUN /usr/bin/easy_install supervisor RUN /usr/bin/easy_install supervisor
RUN /usr/bin/easy_install supervisor-stdout RUN /usr/bin/easy_install supervisor-stdout

View File

@@ -100,6 +100,16 @@ sudo docker run -e 'GIT_REPO=git@git.ngd.io:ngineered/ngineered-website.git' -v
## Special Features ## Special Features
### Push code to Git
To push code changes back to git simply run:
```
sudo docker exec -t -i <CONATINER_NAME> /usr/bin/push
```
### Pull code from Git (Refresh)
In order to refresh the code in a container and pull newer code form git simply run:
```
sudo docker exec -t -i <CONTAINER_NAME> /usr/bin/pull
```
### 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.

14
pull Executable file
View File

@@ -0,0 +1,14 @@
#!/bin/bash
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
cd /usr/share/nginx/html
git pull

21
push Executable file
View File

@@ -0,0 +1,21 @@
#!/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"
git push

View File

@@ -5,6 +5,15 @@
mkdir -p -m 0700 /root/.ssh mkdir -p -m 0700 /root/.ssh
echo -e "Host *\n\tStrictHostKeyChecking no\n" >> /root/.ssh/config 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"
git config --global push.default simple
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/*