feat: ensure .env file exists for docker compose and auto-inject in payloads

This commit is contained in:
Andras Bacsai committed 2025-11-07 15:20:10 +01:00
1 parent d3eba6c1b7
commit 712d60c75b
3 files changed
+16

No files matched your search

+4
View File
@@ -22,6 +22,10 @@ class StartService
$service->isConfigurationChanged(save: true);
$commands[] = 'cd '.$service->workdir();
$commands[] = "echo 'Saved configuration files to {$service->workdir()}.'";
// Ensure .env file exists before docker compose tries to load it
// This is defensive programming - saveComposeConfigs() already creates it,
// but we guarantee it here in case of any edge cases or manual deployments
$commands[] = 'touch .env';
if ($pullLatestImages) {
$commands[] = "echo 'Pulling images.'";
$commands[] = 'docker compose pull';
+6
View File
@@ -3029,6 +3029,12 @@ COPY ./nginx.conf /etc/nginx/conf.d/default.conf");
private function start_by_compose_file()
{
// Ensure .env file exists before docker compose tries to load it (defensive programming)
$this->execute_remote_command(
["touch {$this->workdir}/.env", 'hidden' => true],
["touch {$this->configuration_dir}/.env", 'hidden' => true],
);
if ($this->application->build_pack === 'dockerimage') {
$this->application_deployment_queue->addLogEntry('Pulling latest images from the registry.');
$this->execute_remote_command(