updated stuff
This commit is contained in:
parent
638dc45020
commit
586aa3b5e7
10 changed files with 82 additions and 37 deletions
|
@ -1,36 +1,65 @@
|
|||
# Docker
|
||||
_appup_docker () {
|
||||
if hash docker-compose >/dev/null 2>&1; then
|
||||
if hash docker-machine >/dev/null 2>&1; then
|
||||
if docker-machine status | grep -qi "Stopped"; then
|
||||
read -q "REPLY?Docker Machine is not running, would you like to start it? [y/n] "
|
||||
echo ""
|
||||
|
||||
if [[ "$REPLY" == "y" ]]; then
|
||||
docker-machine start default && eval $(docker-machine env default)
|
||||
# Check if docker has been started
|
||||
if [ "${APPUP_CHECK_STARTED:-true}" = true ]; then
|
||||
if hash docker-machine >/dev/null 2>&1 && [ "${APPUP_DOCKER_MACHINE:-true}" = true ]; then
|
||||
if docker-machine status | grep -qi "Stopped"; then
|
||||
read -r -k 1 "REPLY?Docker Machine is not running, would you like to start it? [y/N] "
|
||||
echo ""
|
||||
|
||||
if [[ "$REPLY" == "y" ]]; then
|
||||
docker-machine start default && eval $(docker-machine env default)
|
||||
echo ""
|
||||
else
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
elif docker ps 2>&1 | grep -qi "Is the docker daemon running?"; then
|
||||
read -r -k 1 "REPLY?Docker for Mac is not running, would you like to start it? [y/N] "
|
||||
echo ""
|
||||
|
||||
if [[ "$REPLY" == "y" ]]; then
|
||||
open -a Docker
|
||||
|
||||
echo ""
|
||||
echo "Waiting for docker to start.."
|
||||
echo ""
|
||||
|
||||
# Wait for it to start
|
||||
while true; do
|
||||
if docker ps 2>&1 | grep -qi "Is the docker daemon running?" || docker ps 2>&1 | grep -qi "connection refused"; then
|
||||
sleep 5
|
||||
else
|
||||
break
|
||||
fi
|
||||
done
|
||||
else
|
||||
return
|
||||
return0
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# Check YAML extension
|
||||
compose_file=''
|
||||
compose_project_file=''
|
||||
|
||||
|
||||
if [ -e "docker-compose.yml" ]; then
|
||||
compose_file='docker-compose.yml'
|
||||
elif [ -e "docker-compose.yaml" ]; then
|
||||
compose_file='docker-compose.yaml'
|
||||
fi
|
||||
|
||||
|
||||
# <cmd> <project name> will look for docker-compose.<project name>.yml
|
||||
if [ -n "$2" ]; then
|
||||
if [ -e "docker-compose.$2.yml" ]; then
|
||||
compose_project_file="docker-compose.$2.yml"
|
||||
elif [ -e "docker-compose.$2.yaml" ]; then
|
||||
compose_project_file="docker-compose.$2.yaml"
|
||||
fi
|
||||
|
||||
if [ -n "$compose_project_file" ]; then
|
||||
|
||||
if [ -n "$compose_project_file" ]; then
|
||||
# Override project name from custom env
|
||||
if [ -e ".env.$2" ]; then
|
||||
project=$(source ".env.$2"; echo $COMPOSE_PROJECT_NAME)
|
||||
|
||||
|
@ -51,6 +80,7 @@ _appup_docker () {
|
|||
fi
|
||||
}
|
||||
|
||||
# Vagrant
|
||||
_appup_vagrant () {
|
||||
if hash vagrant >/dev/null 2>&1; then
|
||||
vagrant $1 "${@:2}"
|
||||
|
@ -59,6 +89,7 @@ _appup_vagrant () {
|
|||
fi
|
||||
}
|
||||
|
||||
# Commands
|
||||
up () {
|
||||
if [ -e "docker-compose.yml" ] || [ -e "docker-compose.yaml" ]; then
|
||||
_appup_docker up "$@"
|
||||
|
@ -108,4 +139,3 @@ stop () {
|
|||
env stop "$@"
|
||||
fi
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue