|
12 | 12 | if [ $# -gt 0 ];then |
13 | 13 | if [ "$1" == "up" ]; then |
14 | 14 | shift 1 |
15 | | - cat file_id.diz |
16 | 15 | $COMPOSE up |
17 | 16 | fi |
| 17 | + if [ "$1" == "build" ]; then |
| 18 | + shift 1 |
| 19 | + $COMPOSE build --parallel && $COMPOSE up |
| 20 | + fi |
| 21 | + if [ "$1" == "test" ]; then |
| 22 | + shift 1 |
| 23 | + docker exec -ti noc /var/www/html/vendor/bin/phpunit /var/www/noc/sbin/tests |
| 24 | + fi |
18 | 25 | if [ "$1" == "ssh" ]; then |
19 | | - container=$(docker ps -q --filter="NAME=$2") |
20 | | - docker exec -ti $container bash |
| 26 | + shift 1 |
| 27 | + container=$(docker ps -q --filter="NAME=$1") |
| 28 | + docker exec -ti ${container} bash |
| 29 | + fi |
| 30 | + if [ "$1" == "mysqlshell" ]; then |
| 31 | + shift 1 |
| 32 | + docker exec -it mysql-docker mysql -u root -h localhost -pmyrootpassword |
| 33 | + docker exec -it mysql-docker /bin/bash |
| 34 | + fi |
| 35 | + if [ "$1" == "purge" ]; then |
| 36 | + shift 1 |
| 37 | + docker stop $(docker ps -a -q) |
| 38 | + docker rm $(docker ps -a -q) |
| 39 | + docker system prune -a -f |
21 | 40 | fi |
22 | 41 | if [ "$1" == "destroy" ]; then |
23 | 42 | shift 1 |
24 | | - # Stop all containers |
25 | 43 | docker stop $(docker ps -a -q) |
26 | | - # Delete all containers |
27 | 44 | docker rm $(docker ps -a -q) |
28 | | - # Delete all images |
29 | | - # docker rmi $(docker images -q) |
30 | 45 | docker system prune -a -f |
31 | | - docker volume prune -f |
| 46 | + docker system prune -a -f --volumes |
32 | 47 | fi |
33 | 48 | else |
| 49 | + clear |
| 50 | + cat <<'EOF' |
| 51 | + ____ ____ ___ __ __ _ __ _ __ __ _ ___ |
| 52 | +( _ \( __)/ __)( )( ( \( ( \( )( ( \ / __) |
| 53 | + ) _ ( ) _)( (_ \ )( / // / )( / /( (_ \ |
| 54 | +(____/(____)\___/(__)\_)__)\_)__)(__)\_)__) \___/ |
| 55 | + ____ _ _ ____ ____ |
| 56 | +( _ \/ )( \( _ \/ _ \ |
| 57 | + ) __/) __ ( ) __/) _ ( |
| 58 | +(__) \_)(_/(__) \____/ |
| 59 | + ____ ____ _ _ |
| 60 | +( \( __)/ )( \ |
| 61 | + ) D ( ) _) \ \/ / |
| 62 | +(____/(____) \__/ |
| 63 | +
|
34 | 64 |
|
35 | | - printf "░▒▓█ Usage \n" |
36 | | - printf "./dev {option} \n\n" |
37 | | - echo "up -- Brings up the dev environment" |
38 | | - echo "down -- Brings down the dev environment" |
39 | | - echo "destroy -- Destorys all docker containers and images" |
40 | | - printf "\n" |
| 65 | +EOF |
| 66 | + docker ps |
| 67 | + printf "\n\n" |
| 68 | + printf "usage:\n" |
| 69 | + printf "./dev {option} \n\n" |
| 70 | + printf "up -- Brings up the dev environment\n" |
| 71 | + printf "build -- Builds and Brings up the dev environment\n" |
| 72 | + printf "mysqlshell -- Connects to mysql container and mysql\n" |
| 73 | + printf "ssh {name} -- Connects to specified container by name\n" |
| 74 | + printf "test -- Run PHPUnit tests\n" |
| 75 | + printf "purge -- Purges all docker containers and images. (Keeps database volumes)\n" |
| 76 | + printf "destroy -- Destorys all docker containers and images\n" |
| 77 | + printf "\n" |
41 | 78 | fi |
0 commit comments