Laravel requires .env file and storage directories during composer install
when running 'php artisan package:discover'. This fix:
1. Creates .env from .env.example (or minimal .env if missing)
2. Creates required storage directories (framework/cache, sessions, views, logs)
3. Creates bootstrap/cache directory
4. Generates APP_KEY after composer install
This resolves the InvalidArgumentException: 'Please provide a valid cache path'
error that occurs in Illuminate/View/Compilers/Compiler.php:36
The php:7.4-cli image is missing ext-exif and ext-zip which are required by:
- spatie/image (requires ext-exif)
- spatie/laravel-backup (requires ext-zip)
- spatie/laravel-medialibrary (depends on spatie/image)
Installing libzip-dev and using docker-php-ext-install to add these extensions.
Previous attempt used composer:2.0 which ships with PHP 8.0.6, but Laravel 7.x
requires PHP ^7.2.5. composer:1 provides PHP 7.4 which is the correct version
for this Laravel application.
- Changed from composer:2.2 (PHP 8.1) to composer:2.0 (PHP 7.4)
- Removed --ignore-platform-reqs flag as it's no longer needed
- PHP 7.4 is fully compatible with Laravel 7.x without deprecation warnings
- This fixes the 'artisan package:discover' error caused by PHP 8.1 strict typing
Updated Drone CI pipeline to use composer:2.2 (PHP 8.1) and added
--ignore-platform-reqs flag to handle legacy dependency locks.
This resolves the PHP version mismatch error in the test step.