fix(image-scan): let a server set the scanner memory limit

Grype was killed at the fixed 1 GiB container limit on large images.

- Add the per-server setting image_scan_memory_mb (1, 2, 4 or 8 GB,
  default 1 GB) on the Vulnerabilities page and in the
  /servers/{uuid}/image-scanning API.
- Set GOMEMLIMIT to 85% of the limit, so Go collects garbage before
  the container limit kills the scanner.
- The out-of-memory error now tells the user to raise the limit.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Andras Bacsai
2026-11-09 17:09:31 +01:00
co-authored by Claude Opus 5.5
parent ae1147003b
commit dc7a5946e9
14 changed files with 291 additions and 28 deletions
@@ -0,0 +1,22 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->unsignedInteger('image_scan_memory_mb')->default(1024);
});
}
public function down(): void
{
Schema::table('server_settings', function (Blueprint $table) {
$table->dropColumn('image_scan_memory_mb');
});
}
};