Skip to content

Instantly share code, notes, and snippets.

@imrodrigoalves
Last active July 30, 2025 08:03
Show Gist options
  • Select an option

  • Save imrodrigoalves/a6ae5bb4f57928f035b370daa930ad98 to your computer and use it in GitHub Desktop.

Select an option

Save imrodrigoalves/a6ae5bb4f57928f035b370daa930ad98 to your computer and use it in GitHub Desktop.
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 example-app --no-interaction && cd example-app && php ./artisan sail:install --with=mysql,redis,meilisearch,mailpit,selenium "
cd example-app
# Allow build with no additional services..
if [ "mysql redis meilisearch mailpit selenium" == "none" ]; then
./vendor/bin/sail build
else
./vendor/bin/sail pull mysql redis meilisearch mailpit selenium
./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 example-app && ./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 example-app && ./vendor/bin/sail up"
fi
@imrodrigoalves
Copy link
Author

imrodrigoalves commented Jul 30, 2025

This information has been lost in recent Laravel 12+ documentation.

Installing dependencies for existing apps (https://laravel.com/docs/11.x/sail#installing-composer-dependencies-for-existing-projects):

docker run --rm \
    -u "$(id -u):$(id -g)" \
    -v "$(pwd):/var/www/html" \
    -w /var/www/html \
    laravelsail/phpXX-composer:latest \
    composer install --ignore-platform-reqs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment