Created
September 16, 2022 07:11
-
-
Save Zwartpet/095a1fcc4d810395c96a1115cede2d4e to your computer and use it in GitHub Desktop.
Sail function
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
function sail { | |
if [[ $1 == "setup" ]]; then | |
printf "\n\nInstalling composer packages.\n\n" | |
VERSION="81" | |
if [ ! -z "$2" ]; then | |
VERSION="$2" | |
fi | |
docker run --rm \ | |
-u "$(id -u):$(id -g)" \ | |
-v $(pwd):/opt \ | |
-w /opt \ | |
laravelsail/php$VERSION-composer:latest \ | |
composer install --ignore-platform-reqs | |
if [[ -f .env.example && ! -f .env ]]; then | |
printf "Setting up the environment variables.\n\n" | |
cp .env.example .env | |
fi | |
printf "\n\nAll done! try using sail -d to start the project\n\n" | |
else | |
vendor/bin/sail "$@" | |
fi | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment