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 \ --pull=always \ -v "$(pwd)":/opt \ -w /opt \ laravelsail/php84-composer:latest \ bash -c "laravel new graphql-demo --no-interaction && cd graphql-demo && php ./artisan sail:install --with=mysql " cd graphql-demo # Allow build with no additional services.. if [ "mysql" == "none" ]; then ./vendor/bin/sail build else ./vendor/bin/sail pull mysql ./vendor/bin/sail build fi CYAN='\033[0;36m' LIGHT_CYAN='\033[1;36m' BOLD='\033[1m' NC='\033[0m' echo "" if command -v doas &>/dev/null; then SUDO="doas" elif command -v sudo &>/dev/null; then SUDO="sudo" else echo "Neither sudo nor doas is available. Exiting." exit 1 fi if $SUDO -n true 2>/dev/null; then $SUDO chown -R $USER: . echo -e "${BOLD}Get started with:${NC} cd graphql-demo && ./vendor/bin/sail up" else echo -e "${BOLD}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 "${BOLD}Thank you! We hope you build something incredible. Dive in with:${NC} cd graphql-demo && ./vendor/bin/sail up" fi