Use this script to create a new laravel docker sail project with just one command. This script will prompt you to enter the name of the project and will also start the project for you.
$ chmod +x create-laravel.sh
./laravel.sh
create_laravel.sh
#!/bin/bash
clear
APPNAME_DEFAULT="api"
read -p "Enter The App you want to Create: [$APPNAME_DEFAULT/] " APPNAME
if [[ $APPNAME == "" ]]
then
APPNAME=$APPNAME_DEFAULT
set -e
fi
#https://stackoverflow.com/questions/59838/how-can-i-check-if-a-directory-exists-in-a-bash-shell-script
# check if directory exists
if [ -d "$APPNAME" ]; then
echo "FATAL FERROR: $APPNAME ALREADY EXIST. Try Again."
set -e
exit
fi
echo "App does not exist. Creating APP: $APPNAME"
curl -s https://laravel.build/$APPNAME | bash
cd $APPNAME
./vendor/bin/sail up -d
# ALWAYS PUT THIS AT THE END OF THE SCRIPT
echo "Opening browser with localhost"
xdg-open http://localhost