fix: always rebuild Dockerfile / dockerimage buildpacks

This commit is contained in:
Andras Bacsai
2024-04-02 20:50:35 +02:00
parent 735081af50
commit 132807b55d
2 changed files with 26 additions and 24 deletions

View File

@@ -234,7 +234,7 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
$this->build_server = $this->server; $this->build_server = $this->server;
$this->original_server = $this->server; $this->original_server = $this->server;
} }
if ($this->restart_only && $this->application->build_pack !== 'dockerimage') { if ($this->restart_only && $this->application->build_pack !== 'dockerimage' && $this->application->build_pack !== 'dockerfile') {
$this->just_restart(); $this->just_restart();
if ($this->server->isProxyShouldRun()) { if ($this->server->isProxyShouldRun()) {
dispatch(new ContainerStatusJob($this->server)); dispatch(new ContainerStatusJob($this->server));
@@ -326,17 +326,19 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
], ],
); );
$this->generate_image_names(); $this->generate_image_names();
if (!$this->force_rebuild) {
$this->check_image_locally_or_remotely(); // Always rebuild dockerfile based container.
if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) { // if (!$this->force_rebuild) {
$this->create_workdir(); // $this->check_image_locally_or_remotely();
$this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped."); // if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
$this->generate_compose_file(); // $this->create_workdir();
$this->push_to_docker_registry(); // $this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
$this->rolling_update(); // $this->generate_compose_file();
return; // $this->push_to_docker_registry();
} // $this->rolling_update();
} // return;
// }
// }
$this->generate_compose_file(); $this->generate_compose_file();
$this->generate_build_env_variables(); $this->generate_build_env_variables();
$this->add_build_env_variables_to_dockerfile(); $this->add_build_env_variables_to_dockerfile();
@@ -467,17 +469,17 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
$this->set_base_dir(); $this->set_base_dir();
$this->generate_image_names(); $this->generate_image_names();
$this->clone_repository(); $this->clone_repository();
if (!$this->force_rebuild) { // if (!$this->force_rebuild) {
$this->check_image_locally_or_remotely(); // $this->check_image_locally_or_remotely();
if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) { // if (str($this->saved_outputs->get('local_image_found'))->isNotEmpty() && !$this->application->isConfigurationChanged()) {
$this->create_workdir(); // $this->create_workdir();
$this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped."); // $this->application_deployment_queue->addLogEntry("No configuration changed & image found ({$this->production_image_name}) with the same Git Commit SHA. Build step skipped.");
$this->generate_compose_file(); // $this->generate_compose_file();
$this->push_to_docker_registry(); // $this->push_to_docker_registry();
$this->rolling_update(); // $this->rolling_update();
return; // return;
} // }
} // }
$this->cleanup_git(); $this->cleanup_git();
$this->generate_compose_file(); $this->generate_compose_file();
$this->generate_build_env_variables(); $this->generate_build_env_variables();

View File

@@ -87,7 +87,7 @@
<div @class([ <div @class([
'font-mono', 'font-mono',
'dark:text-warning whitespace-pre-line' => $line['hidden'], 'dark:text-warning whitespace-pre-line' => $line['hidden'],
'text-red-500 whitespace-pre-line' => $line['type'] == 'stderr', 'text-red-500 font-bold whitespace-pre-line' => $line['type'] == 'stderr',
])>[{{ $line['timestamp'] }}] @if ($line['hidden']) ])>[{{ $line['timestamp'] }}] @if ($line['hidden'])
<br>COMMAND: <br>{{ $line['command'] }} <br><br>OUTPUT: <br>COMMAND: <br>{{ $line['command'] }} <br><br>OUTPUT:
@endif @if (str($line['output'])->contains('http://') || str($line['output'])->contains('https://')) @endif @if (str($line['output'])->contains('http://') || str($line['output'])->contains('https://'))