Skip to content

Instantly share code, notes, and snippets.

@wffranco
Last active July 19, 2024 21:01
Show Gist options
  • Save wffranco/e6974f80ed4703ff45c540637a2c66a5 to your computer and use it in GitHub Desktop.
Save wffranco/e6974f80ed4703ff45c540637a2c66a5 to your computer and use it in GitHub Desktop.
Sail local command for laravel with php 8.3. It will run automatically the first `composer` installation if `vendor` folder is missing.
#!/usr/bin/env bash
cd "$(dirname "${BASH_SOURCE[0]}")"
#if the command is called with `init` param, or `vendor` folder is missing
if [ "$1" = "init" ] || [ ! -d vendor ]; then
#run laravel sail container to run `composer install`
docker run --rm \
-u "$(id -u):$(id -g)" \
-v $(pwd):/var/www/html \
-w /var/www/html \
laravelsail/php81-composer:latest \
composer install --ignore-platform-reqs
fi
if [ "$1" != "init" ]; then
./vendor/bin/sail $@
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment