Created
March 10, 2022 17:35
-
-
Save Parables/25ce616b94d556330e7ae81668133b9d to your computer and use it in GitHub Desktop.
Create a new Laravel Sail project https://laravel.com/docs/9.x#getting-started-on-linux
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# curl -s https://laravel.build/projectName | |
echo "Creating a new Laravel Sail project..." | |
projectName="$1" | |
if [ -z "$1" ]; then | |
echo -n "Please enter the name for your Project " | |
read inputName | |
projectName="$inputName" | |
fi | |
echo "Project name is: $projectName" | |
docker info > /dev/null 2>&1 | |
# Ensure that Docker is running... | |
if [ $? -ne 0 ]; then | |
echo "Docker is not running." | |
exit 1 | |
fi | |
docker run --rm \ | |
-v "$(pwd)":/opt \ | |
-w /opt \ | |
laravelsail/php81-composer:latest \ | |
bash -c "laravel new $projectName && cd $projectName && php ./artisan sail:install --with=mysql,redis,meilisearch,mailhog,selenium " | |
cd "$projectName" | |
CYAN='\033[0;36m' | |
LIGHT_CYAN='\033[1;36m' | |
WHITE='\033[1;37m' | |
NC='\033[0m' | |
echo "" | |
if sudo -n true 2>/dev/null; then | |
sudo chown -R $USER: . | |
echo -e "${WHITE}Get started with:${NC} cd $projectName && ./vendor/bin/sail up" | |
else | |
echo -e "${WHITE}Please provide your password so we can make some final adjustments to your application's permissions.${NC}" | |
echo "" | |
sudo chown -R $USER: . | |
echo "" | |
echo -e "${WHITE}Thank you! We hope you build something incredible. Dive in with:${NC} cd $projectName && ./vendor/bin/sail up" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment