Skip to content

Instantly share code, notes, and snippets.

@Zwartpet
Created September 16, 2022 07:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Zwartpet/095a1fcc4d810395c96a1115cede2d4e to your computer and use it in GitHub Desktop.
Save Zwartpet/095a1fcc4d810395c96a1115cede2d4e to your computer and use it in GitHub Desktop.
Sail function
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