Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env bash
- # The d
- # A simple wrapper for the docker-compose command.
- projectName=$(basename "$PWD")
- # rewrite php artisan shortcut
- if [ "$1" = "a" ]; then
- set -- "php" "artisan" "${@:2}"
- fi
- # check whether we should run a docker compose command...
- # (conflicting commands will be ignored: rm, ps, kill, top, exec, help)
- if [[ "$1" =~ ^(build|bundle|config|create|down|events|images|logs|pause|port|pull|push|restart|run|scale|start|stop|unpause|up|version)$ ]]; then
- docker-compose -p $projectName -f ./docker/local/docker-compose.yml "$@"
- elif [[ "$1" =~ ^(.rm|.ps|.kill|.top|.exec|.help) ]]; then
- # rewrite conflicting commands to its original one
- firstArg="$1";
- set -- "${firstArg:1}" "${@:2}"
- docker-compose -p $projectName -f ./docker/local/docker-compose.yml "$@"
- else
- # ...or forward the command to the container
- containerName=${C:-app}
- docker-compose -p $projectName -f ./docker/local/docker-compose.yml exec $containerName "$@"
- fi
Add Comment
Please, Sign In to add comment