Dockerized for dev purposes
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled

This commit is contained in:
2025-11-04 19:25:30 +10:00
parent ca4569cb8f
commit c0618ce3e4
7 changed files with 790 additions and 674 deletions

View File

@@ -0,0 +1,64 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Artisan;
use Symfony\Component\Process\Process;
class InitializeApp extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'app:initialize-app';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description';
/**
* Execute the console command.
*/
public function handle()
{
$this->info('🚀 Initializing application...');
// Composer install
$this->info('📦 Installing Composer dependencies...');
$this->runProcess(['composer', 'install', '--no-interaction']);
// NPM install
$this->info('📦 Installing NPM dependencies...');
$this->runProcess(['npm', 'install']);
// Generate key
$this->info('🔑 Generating application key...');
Artisan::call('key:generate', [], $this->output);
// Migrate and seed
$this->info('🗄️ Running migrations and seeders...');
Artisan::call('migrate:fresh', ['--seed' => true], $this->output);
$this->info('✅ Application initialized successfully!');
}
private function runProcess(array $command)
{
$process = new Process($command);
$process->setTimeout(300); // 5 minutes
$process->run(function ($type, $buffer) {
echo $buffer;
});
if (!$process->isSuccessful()) {
$this->error("Failed to run: " . implode(' ', $command));
exit(1);
}
}
}