build logs
This commit is contained in:
41
database/factories/DockerImageBuildFactory.php
Normal file
41
database/factories/DockerImageBuildFactory.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\DockerImageBuild;
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
/**
|
||||
* @extends Factory<DockerImageBuild>
|
||||
*/
|
||||
class DockerImageBuildFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'user_id' => User::factory(),
|
||||
'image_name' => 'ghcr.io/acme/'.fake()->slug(2),
|
||||
'image_tag' => 'latest',
|
||||
'dockerfile_content' => implode("\n", [
|
||||
'FROM alpine:3.20',
|
||||
'RUN echo "building"',
|
||||
]),
|
||||
'environment' => [
|
||||
['key' => 'APP_ENV', 'value' => 'production'],
|
||||
],
|
||||
'status' => DockerImageBuild::STATUS_QUEUED,
|
||||
'build_output' => null,
|
||||
'successful' => null,
|
||||
'exit_code' => null,
|
||||
'queued_at' => now(),
|
||||
'started_at' => null,
|
||||
'finished_at' => null,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('docker_image_builds', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignIdFor(User::class)->constrained()->cascadeOnDelete();
|
||||
$table->string('image_name');
|
||||
$table->string('image_tag', 128);
|
||||
$table->longText('dockerfile_content');
|
||||
$table->json('environment')->nullable();
|
||||
$table->string('status', 20)->index();
|
||||
$table->longText('build_output')->nullable();
|
||||
$table->boolean('successful')->nullable();
|
||||
$table->integer('exit_code')->nullable();
|
||||
$table->timestamp('queued_at')->nullable()->index();
|
||||
$table->timestamp('started_at')->nullable();
|
||||
$table->timestamp('finished_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('docker_image_builds');
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user