Skip to content

Instantly share code, notes, and snippets.

@otaavioo
Created October 27, 2017 19:39
Show Gist options
  • Save otaavioo/62f682ceb05ff4b42cb44a2c15d6b129 to your computer and use it in GitHub Desktop.
Save otaavioo/62f682ceb05ff4b42cb44a2c15d6b129 to your computer and use it in GitHub Desktop.
deploy project with docker
#!/bin/bash
# Colors
RESET="\033[0m"
CY="\033[1;33m"
CG="\033[0;32m"
_verify_parameters()
{
branch=$1
if [ -z $branch ]
then
printf "\\n %s " "Para executar o deploy-local, utilize o comando abaixo:"
printf " %s\\n" "./deploy branch-name"
exit 1
fi
}
_checkout_branch()
{
branch=$1
git pull --all
branch_exists=$(git branch -a | grep remotes/origin/$branch)
if [ -n $branch_exists ]
then
git checkout $branch
git pull origin $branch
return
fi
git checkout producao
git pull origin producao
_run_composer
}
_run_composer()
{
./composer install
}
#!/bin/bash
path=$(pwd)
. /www/deploy/functions.sh
cd /www/path-to-dir/
_verify_parameters $1
_checkout_branch $1
cd $path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment