From c866213f34513f4caa912a41f228efc6f2bb680a Mon Sep 17 00:00:00 2001 From: Andras Bacsai Date: Thu, 16 Nov 2023 13:22:12 +0100 Subject: [PATCH] fix: when to pull image --- app/Jobs/ApplicationDeploymentJob.php | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php index 9c0475610..7851d3fe5 100644 --- a/app/Jobs/ApplicationDeploymentJob.php +++ b/app/Jobs/ApplicationDeploymentJob.php @@ -1096,21 +1096,19 @@ private function stop_running_container(bool $force = false) private function start_by_compose_file() { - if ( - !$this->application->dockerfile && - ( - $this->application->build_pack === 'dockerimage' || - $this->application->build_pack === 'dockerfile') - ) { + if ($this->application->dockerfile || $this->application->build_pack === 'dockerfile') { + $this->execute_remote_command( + ["echo -n 'Starting application (could take a while).'"], + [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} up --build -d"), "hidden" => true], + ); + } else if ($this->application->build_pack === 'dockerimage') { $this->execute_remote_command( ["echo -n 'Pulling latest images from the registry.'"], - [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir}"), "hidden" => true], + [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} pull"), "hidden" => true], + ["echo -n 'Starting application (could take a while).'"], + [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} up --build -d"), "hidden" => true], ); } - $this->execute_remote_command( - ["echo -n 'Starting application (could take a while).'"], - [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} up --build -d"), "hidden" => true], - ); } private function generate_build_env_variables()