11#! /bin/bash
22
3+ # This shell script is an optional tool to simplify
4+ # the installation and usage of laradock with docker-sync.
5+
6+ # To run, make sure to add permissions to this file:
7+ # chmod 755 sync.sh
8+
9+ # Usage:
10+ # Install docker-sync: ./sync.sh install
11+ # Start workspace with nginx and mysql: ./sync.sh up nginx mysql
12+ # Open bash inside the workspace: ./sync.sh bash
13+ # Stop workspace: ./sync.sh down
14+ # Force sync: ./sync.sh trigger
15+ # Clean synced files: ./sync.sh clean
16+
317# prints colored text
418print_style () {
519
@@ -26,6 +40,7 @@ display_options () {
2640 print_style " install" " success" ; printf " \t\t Installs docker-sync gem on the host machine.\n" ;
2741 print_style " up [services]" " success" ; printf " \t Starts docker-sync and runs docker compose.\n" ;
2842 print_style " down" " success" ; printf " \t\t\t Stops containers and docker-sync.\n" ;
43+ print_style " bash" " success" ; printf " \t\t\t Opens bash on the workspace\n" ;
2944 print_style " trigger" " success" ; printf " \t\t Manually triggers the synchronization of files.\n" ;
3045 print_style " clean" " warning" ; printf " \t\t Removes all files from the docker-sync container.\n" ;
3146}
@@ -56,6 +71,9 @@ elif [ "$1" == "install" ]; then
5671 print_style " Installing docker-sync\n" " info" ;
5772 gem install docker-sync;
5873
74+ elif [ " $1 " == " bash" ]; then
75+ docker-compose exec workspace bash;
76+
5977elif [ " $1 " == " trigger" ]; then
6078 print_style " Manually triggering sync between host and docker-sync container.\n" " info" ;
6179 docker-sync sync;
@@ -64,6 +82,7 @@ elif [ "$1" == "clean" ]; then
6482 print_style " Removing and cleaning up files from the docker-sync container.\n" " warning" ;
6583 docker-sync clean;
6684
85+
6786else
6887 print_style " Invalid arguments.\n" " danger" ;
6988 display_options;
0 commit comments