Merge branch 'master' into stable
This commit is contained in:
@@ -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
|
||||
|
||||
10
README.md
10
README.md
@@ -100,6 +100,16 @@ sudo docker run -e 'GIT_REPO=git@git.ngd.io:ngineered/ngineered-website.git' -v
|
||||
|
||||
## 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
|
||||
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
14
pull
Executable 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
21
push
Executable 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
|
||||
9
start.sh
9
start.sh
@@ -5,6 +5,15 @@
|
||||
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"
|
||||
git config --global push.default simple
|
||||
fi
|
||||
|
||||
# Pull down code form git for our site!
|
||||
if [ ! -z "$GIT_REPO" ]; then
|
||||
rm /usr/share/nginx/html/*
|
||||
|
||||
Reference in New Issue
Block a user