Guest User

Untitled

a guest
Jun 21st, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # The d
  4. # A simple wrapper for the docker-compose command.
  5.  
  6. projectName=$(basename "$PWD")
  7.  
  8. # rewrite php artisan shortcut
  9. if [ "$1" = "a" ]; then
  10. set -- "php" "artisan" "${@:2}"
  11. fi
  12.  
  13. # check whether we should run a docker compose command...
  14. # (conflicting commands will be ignored: rm, ps, kill, top, exec, help)
  15. if [[ "$1" =~ ^(build|bundle|config|create|down|events|images|logs|pause|port|pull|push|restart|run|scale|start|stop|unpause|up|version)$ ]]; then
  16. docker-compose -p $projectName -f ./docker/local/docker-compose.yml "$@"
  17. elif [[ "$1" =~ ^(.rm|.ps|.kill|.top|.exec|.help) ]]; then
  18. # rewrite conflicting commands to its original one
  19. firstArg="$1";
  20. set -- "${firstArg:1}" "${@:2}"
  21. docker-compose -p $projectName -f ./docker/local/docker-compose.yml "$@"
  22. else
  23. # ...or forward the command to the container
  24. containerName=${C:-app}
  25. docker-compose -p $projectName -f ./docker/local/docker-compose.yml exec $containerName "$@"
  26. fi
Add Comment
Please, Sign In to add comment