From a7c4e06bc3d30904d141daecc24b2682207569c2 Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Fri, 28 Apr 2023 09:00:47 +0200 Subject: [PATCH] remove dangling images --- app/Console/Kernel.php | 6 ++-- app/Jobs/DockerCleanupDanglingImagesJob.php | 36 +++++++++++++++++++++ scripts/run | 6 ++++ 3 files changed, 46 insertions(+), 2 deletions(-) create mode 100644 app/Jobs/DockerCleanupDanglingImagesJob.php diff --git a/app/Console/Kernel.php b/app/Console/Kernel.php index 2e89847f0..dd11eeba3 100644 --- a/app/Console/Kernel.php +++ b/app/Console/Kernel.php @@ -3,6 +3,7 @@ namespace App\Console; use App\Jobs\ContainerStatusJob; +use App\Jobs\DockerCleanupDanglingImagesJob; use Illuminate\Console\Scheduling\Schedule; use Illuminate\Foundation\Console\Kernel as ConsoleKernel; @@ -13,7 +14,8 @@ class Kernel extends ConsoleKernel */ protected function schedule(Schedule $schedule): void { - $schedule->job(new ContainerStatusJob)->everyMinute(); + $schedule->job(new ContainerStatusJob)->everyFiveMinutes(); + $schedule->job(new DockerCleanupDanglingImagesJob)->everyMinute(); } /** @@ -21,7 +23,7 @@ protected function schedule(Schedule $schedule): void */ protected function commands(): void { - $this->load(__DIR__.'/Commands'); + $this->load(__DIR__ . '/Commands'); require base_path('routes/console.php'); } diff --git a/app/Jobs/DockerCleanupDanglingImagesJob.php b/app/Jobs/DockerCleanupDanglingImagesJob.php new file mode 100644 index 000000000..cab8953b2 --- /dev/null +++ b/app/Jobs/DockerCleanupDanglingImagesJob.php @@ -0,0 +1,36 @@ +