Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

Build images prior to rollout.

Stuart Rowlandsefe043ec9d77
diff --git a/app/Jobs/ApplicationDeploymentJob.php b/app/Jobs/ApplicationDeploymentJob.php
index 838bd7dd6e..4de85f6ae2 100644
--- a/app/Jobs/ApplicationDeploymentJob.php
+++ b/app/Jobs/ApplicationDeploymentJob.php
@@ -451,6 +451,8 @@ class ApplicationDeploymentJob implements ShouldQueue, ShouldBeEncrypted
executeInDocker($this->deployment_uuid, "echo '{$this->docker_compose_base64}' | base64 -d > {$this->workdir}{$this->docker_compose_location}"), "hidden" => true
]);
$this->save_environment_variables();
+ // Build new container to limit downtime.
+ $this->build_by_compose_file();
$this->stop_running_container(force: true);
$networkId = $this->application->uuid;
@@ -1243,6 +1245,27 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
}
}
+ private function build_by_compose_file() {
+ if ($this->application->build_pack === 'dockerimage') {
+ $this->application_deployment_queue->addLogEntry("Pulling latest images from the registry.");
+ $this->execute_remote_command(
+ [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} pull"), "hidden" => true],
+ [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} build"), "hidden" => true],
+ );
+ } else {
+ if ($this->docker_compose_location) {
+ $this->execute_remote_command(
+ [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} -f {$this->workdir}{$this->docker_compose_location} build"), "hidden" => true],
+ );
+ } else {
+ $this->execute_remote_command(
+ [executeInDocker($this->deployment_uuid, "docker compose --project-directory {$this->workdir} build"), "hidden" => true],
+ );
+ }
+ }
+ $this->application_deployment_queue->addLogEntry("New images built.");
+ }
+
private function start_by_compose_file()
{
if ($this->application->build_pack === 'dockerimage') {