https://hub.docker.com/repository/docker/dschreck/laravel-spatie-composer
When using Laravel and Sail it's preferred to avoid installing PHP and composer locally. This can be solved by using composer directly from Docker Hub.
The gotcha here is when you'd like to also use Spatie's laravel-medialibrary. As it asks for some additional libraries to be installed.
This is my quick hack solution to it.
Other's may have better ones, but this is mine 🤷
# change director to your local fresh checkout (sans `vendor` folder)
docker run --rm \
-v "$(pwd)":/app \
-w /app \
dschreck/laravel-spatie-composer:latest \
composer install
# build
docker build -t dschreck/laravel-spatie-composer .
# login to docker
docker login
# push
docker push dschreck/laravel-spatie-composer:latest