Skip to content

Instantly share code, notes, and snippets.

@mosluce
Created April 30, 2015 07:26
Show Gist options
  • Save mosluce/6aa3155e41b5c06c5e48 to your computer and use it in GitHub Desktop.
Save mosluce/6aa3155e41b5c06c5e48 to your computer and use it in GitHub Desktop.
#!/bin/bash
if [ $# -eq 0 ] ; then
echo "input app name, plz"
exit 0
fi
#echo $1
home="/home/mosluce"
app="$home/apps/$1"
repo="$home/repos/$1.git"
hook="$repo/hooks/post-receive"
if [ -d $app ]; then
echo "exists"
exit 0;
fi
mkdir -p $app
mkdir -p $repo
cd $repo
git init --bare
git config core.bare false
git config core.worktree $app
git config receive.denyCurrentBranch ignore
echo -e "#!/bin/bash \ngit checkout -f \ndocker exec $1 /launch" > $hook
chmod +x $hook
docker run -t -i -d --expose 8081 -P -v "/home/mosluce/apps/$1":/app --name="$1" mosluce/node
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment