CRITICAL FIX: Move composer install after containers start
The previous setup scripts ran 'composer install' in a temporary container before starting the actual containers. This caused vendor/ directory to be created inside the temporary container and then deleted, leaving the host filesystem without dependencies. Changes: - setup.bat: Move composer install to Step 4 (after containers start) - setup.sh: Move composer install to Step 4 (after containers start) - Use 'docker-compose exec' instead of 'docker-compose run --rm' - This ensures vendor/ is written to the host filesystem via volume mount - Added TEST_SETUP.md with comprehensive testing procedures Now the vendor/ directory will persist correctly on Windows/WSL2 and the app will load without 'vendor/autoload.php not found' errors. This was the root cause of the setup not being truly '2-minute ready'.
This commit is contained in:
34
setup.bat
34
setup.bat
@@ -34,11 +34,10 @@ if exist "src\.env.%DB%" (
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
REM Step 2: Install composer dependencies
|
||||
echo Installing composer dependencies...
|
||||
REM Step 2: Build containers
|
||||
echo Building Docker containers...
|
||||
docker-compose build
|
||||
docker-compose --profile %DB% run --rm app composer install --no-interaction
|
||||
echo Dependencies installed
|
||||
echo Containers built
|
||||
echo.
|
||||
|
||||
REM Step 3: Start containers
|
||||
@@ -47,7 +46,13 @@ docker-compose --profile %DB% up -d
|
||||
echo Containers started
|
||||
echo.
|
||||
|
||||
REM Step 4: Wait for database
|
||||
REM Step 4: Install composer dependencies
|
||||
echo Installing composer dependencies...
|
||||
docker-compose exec app composer install --no-interaction
|
||||
echo Dependencies installed
|
||||
echo.
|
||||
|
||||
REM Step 5: Wait for database
|
||||
if "%DB%"=="mysql" (
|
||||
echo Waiting for database...
|
||||
timeout /t 5 /nobreak >nul
|
||||
@@ -61,27 +66,28 @@ if "%DB%"=="pgsql" (
|
||||
echo.
|
||||
)
|
||||
|
||||
REM Step 5: Generate app key
|
||||
REM Step 6: Generate app key
|
||||
echo Generating application key...
|
||||
docker-compose exec app php artisan key:generate --force
|
||||
echo App key generated
|
||||
echo.
|
||||
|
||||
REM Step 6: Run migrations
|
||||
echo → Running database migrations...
|
||||
REM Step 7: Run migrations
|
||||
echo Running database migrations...
|
||||
docker-compose exec app php artisan migrate --force
|
||||
echo ✓ Migrations completed
|
||||
echo Migrations completed
|
||||
echo.
|
||||
|
||||
echo → Seeding database (roles, permissions, admin user)...
|
||||
REM Step 8: Seed database
|
||||
echo Seeding database (roles, permissions, admin user)...
|
||||
docker-compose exec app php artisan db:seed --force
|
||||
echo ✓ Database seeded
|
||||
echo Database seeded
|
||||
echo.
|
||||
|
||||
REM Step 7: Create storage link
|
||||
echo → Creating storage symlink...
|
||||
REM Step 9: Create storage link
|
||||
echo Creating storage symlink...
|
||||
docker-compose exec app php artisan storage:link
|
||||
echo ✓ Storage linked
|
||||
echo Storage linked
|
||||
echo.
|
||||
|
||||
REM Done
|
||||
|
||||
Reference in New Issue
Block a user