adding base functions
This commit is contained in:
parent
a670dd91cd
commit
7b180524e3
47
laradock.sh
47
laradock.sh
|
@ -8,9 +8,9 @@
|
||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# Install docker-sync: ./sync.sh install
|
# Install docker-sync: ./sync.sh install
|
||||||
# Start workspace with nginx and mysql: ./sync.sh up nginx mysql
|
# Start sync and services with nginx and mysql: ./sync.sh up nginx mysql
|
||||||
# Open bash inside the workspace: ./sync.sh bash
|
# Open bash inside the workspace: ./sync.sh bash
|
||||||
# Stop workspace: ./sync.sh down
|
# Stop containers and sync: ./sync.sh down
|
||||||
# Force sync: ./sync.sh trigger
|
# Force sync: ./sync.sh trigger
|
||||||
# Clean synced files: ./sync.sh clean
|
# Clean synced files: ./sync.sh clean
|
||||||
|
|
||||||
|
@ -51,7 +51,11 @@ if [[ $# -eq 0 ]] ; then
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "$1" == "up" ] ; then
|
if [ "$1" == "sync" ] ; then
|
||||||
|
shift; # removing first argument
|
||||||
|
print_style "Using Docker Sync\n" "info";
|
||||||
|
|
||||||
|
if [ "$1" == "up" ] ; then
|
||||||
print_style "Initializing Docker Sync\n" "info";
|
print_style "Initializing Docker Sync\n" "info";
|
||||||
print_style "May take a long time (15min+) the first run\n" "info";
|
print_style "May take a long time (15min+) the first run\n" "info";
|
||||||
docker-sync start;
|
docker-sync start;
|
||||||
|
@ -60,31 +64,48 @@ if [ "$1" == "up" ] ; then
|
||||||
shift; # removing first argument
|
shift; # removing first argument
|
||||||
docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@};
|
docker-compose -f docker-compose.yml -f docker-compose.sync.yml up -d ${@};
|
||||||
|
|
||||||
elif [ "$1" == "down" ]; then
|
elif [ "$1" == "down" ]; then
|
||||||
print_style "Stopping Docker Compose\n" "info";
|
print_style "Stopping Docker Compose\n" "info";
|
||||||
docker-compose down;
|
docker-compose down;
|
||||||
|
|
||||||
print_style "Stopping Docker Sync\n" "info";
|
print_style "Stopping Docker Sync\n" "info";
|
||||||
docker-sync stop;
|
docker-sync stop;
|
||||||
|
|
||||||
elif [ "$1" == "install" ]; then
|
elif [ "$1" == "install" ]; then
|
||||||
print_style "Installing docker-sync\n" "info";
|
print_style "Installing docker-sync\n" "info";
|
||||||
gem install docker-sync;
|
gem install docker-sync;
|
||||||
|
|
||||||
elif [ "$1" == "bash" ]; then
|
elif [ "$1" == "trigger" ]; then
|
||||||
docker-compose exec workspace bash;
|
|
||||||
|
|
||||||
elif [ "$1" == "trigger" ]; then
|
|
||||||
print_style "Manually triggering sync between host and docker-sync container.\n" "info";
|
print_style "Manually triggering sync between host and docker-sync container.\n" "info";
|
||||||
docker-sync sync;
|
docker-sync sync;
|
||||||
|
|
||||||
elif [ "$1" == "clean" ]; then
|
elif [ "$1" == "clean" ]; then
|
||||||
print_style "Removing and cleaning up files from the docker-sync container.\n" "warning";
|
print_style "Removing and cleaning up files from the docker-sync container.\n" "warning";
|
||||||
docker-sync clean;
|
docker-sync clean;
|
||||||
|
else
|
||||||
|
|
||||||
else
|
|
||||||
print_style "Invalid arguments.\n" "danger";
|
print_style "Invalid arguments.\n" "danger";
|
||||||
display_options;
|
display_options;
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
print_style "Not using synced files might be slow on OSX and Windows. Use 'sync' option to speed up.\n";
|
||||||
|
|
||||||
|
if [ "$1" == "up" ] ; then
|
||||||
|
print_style "Initializing Docker Compose\n" "info";
|
||||||
|
shift; # removing first argument
|
||||||
|
docker-compose up -d ${@};
|
||||||
|
|
||||||
|
elif [ "$1" == "down" ]; then
|
||||||
|
print_style "Stopping Docker Compose\n" "info";
|
||||||
|
docker-compose down;
|
||||||
|
|
||||||
|
elif [ "$1" == "bash" ]; then
|
||||||
|
docker-compose exec workspace bash;
|
||||||
|
|
||||||
|
else
|
||||||
|
print_style "Invalid arguments.\n" "danger";
|
||||||
|
display_options;
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in New Issue