remove dangling images
This commit is contained in:
parent
befc51beec
commit
a7c4e06bc3
@ -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();
|
||||
}
|
||||
|
||||
/**
|
||||
|
36
app/Jobs/DockerCleanupDanglingImagesJob.php
Normal file
36
app/Jobs/DockerCleanupDanglingImagesJob.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Models\Server;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class DockerCleanupDanglingImagesJob implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$servers = Server::all();
|
||||
foreach ($servers as $server) {
|
||||
runRemoteCommandSync($server, ['docker image prune -f']);
|
||||
}
|
||||
}
|
||||
}
|
@ -23,6 +23,12 @@ function help {
|
||||
function queue {
|
||||
bash vendor/bin/spin exec -u webuser coolify php artisan queue:listen
|
||||
}
|
||||
function schedule {
|
||||
bash vendor/bin/spin exec -u webuser coolify php artisan schedule:work
|
||||
}
|
||||
function schedule-run {
|
||||
bash vendor/bin/spin exec -u webuser coolify php artisan schedule:run
|
||||
}
|
||||
function reset-db {
|
||||
bash vendor/bin/spin exec -u webuser coolify php artisan migrate:fresh --seed
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user