mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
Merge d36bc84b5d into b8d57bfd3c
This commit is contained in:
commit
57c39d9f57
3 changed files with 22 additions and 12 deletions
|
|
@ -224,7 +224,11 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
||||||
|
|
||||||
$this->basedir = $this->application->generateBaseDir($this->deployment_uuid);
|
$this->basedir = $this->application->generateBaseDir($this->deployment_uuid);
|
||||||
$this->workdir = "{$this->basedir}".rtrim($this->application->base_directory, '/');
|
$this->workdir = "{$this->basedir}".rtrim($this->application->base_directory, '/');
|
||||||
$this->configuration_dir = application_configuration_dir()."/{$this->application->uuid}";
|
if ($this->pull_request_id !== 0) {
|
||||||
|
$this->configuration_dir = application_configuration_dir()."/".addPreviewDeploymentSuffix($this->application->uuid, $this->pull_request_id);
|
||||||
|
} else {
|
||||||
|
$this->configuration_dir = application_configuration_dir()."/{$this->application->uuid}";
|
||||||
|
}
|
||||||
$this->is_debug_enabled = $this->application->settings->is_debug_enabled;
|
$this->is_debug_enabled = $this->application->settings->is_debug_enabled;
|
||||||
|
|
||||||
$this->container_name = generateApplicationContainerName($this->application, $this->pull_request_id);
|
$this->container_name = generateApplicationContainerName($this->application, $this->pull_request_id);
|
||||||
|
|
@ -759,6 +763,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
||||||
|
|
||||||
// Start compose file
|
// Start compose file
|
||||||
$server_workdir = $this->application->workdir();
|
$server_workdir = $this->application->workdir();
|
||||||
|
if ($this->pull_request_id !== 0) {
|
||||||
|
$server_workdir = application_configuration_dir()."/".addPreviewDeploymentSuffix($this->application->uuid, $this->pull_request_id);
|
||||||
|
}
|
||||||
if ($this->application->settings->is_raw_compose_deployment_enabled) {
|
if ($this->application->settings->is_raw_compose_deployment_enabled) {
|
||||||
if ($this->docker_compose_custom_start_command) {
|
if ($this->docker_compose_custom_start_command) {
|
||||||
// Auto-inject -f (compose file) and --env-file flags using helper function
|
// Auto-inject -f (compose file) and --env-file flags using helper function
|
||||||
|
|
|
||||||
|
|
@ -788,10 +788,10 @@ function applicationParser(Application $resource, int $pull_request_id = 0, ?int
|
||||||
} else {
|
} else {
|
||||||
$mainDirectory = str(base_configuration_dir().'/applications/'.$uuid);
|
$mainDirectory = str(base_configuration_dir().'/applications/'.$uuid);
|
||||||
}
|
}
|
||||||
$source = replaceLocalSource($source, $mainDirectory);
|
|
||||||
if ($isPullRequest) {
|
if ($isPullRequest) {
|
||||||
$source = addPreviewDeploymentSuffix($source, $pull_request_id);
|
$mainDirectory = str(addPreviewDeploymentSuffix($mainDirectory, $pull_request_id));
|
||||||
}
|
}
|
||||||
|
$source = replaceLocalSource($source, $mainDirectory);
|
||||||
LocalFileVolume::updateOrCreate(
|
LocalFileVolume::updateOrCreate(
|
||||||
[
|
[
|
||||||
'mount_path' => $target,
|
'mount_path' => $target,
|
||||||
|
|
|
||||||
|
|
@ -2526,15 +2526,15 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||||
$mount = $volume->after(':');
|
$mount = $volume->after(':');
|
||||||
if ($name->startsWith('.') || $name->startsWith('~')) {
|
if ($name->startsWith('.') || $name->startsWith('~')) {
|
||||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
||||||
|
if ($pull_request_id !== 0) {
|
||||||
|
$dir = addPreviewDeploymentSuffix($dir, $pull_request_id);
|
||||||
|
}
|
||||||
if ($name->startsWith('.')) {
|
if ($name->startsWith('.')) {
|
||||||
$name = $name->replaceFirst('.', $dir);
|
$name = $name->replaceFirst('.', $dir);
|
||||||
}
|
}
|
||||||
if ($name->startsWith('~')) {
|
if ($name->startsWith('~')) {
|
||||||
$name = $name->replaceFirst('~', $dir);
|
$name = $name->replaceFirst('~', $dir);
|
||||||
}
|
}
|
||||||
if ($pull_request_id !== 0) {
|
|
||||||
$name = addPreviewDeploymentSuffix($name, $pull_request_id);
|
|
||||||
}
|
|
||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
} else {
|
} else {
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
|
|
@ -2589,15 +2589,15 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||||
if ($source && $target) {
|
if ($source && $target) {
|
||||||
if ((str($source)->startsWith('.') || str($source)->startsWith('~'))) {
|
if ((str($source)->startsWith('.') || str($source)->startsWith('~'))) {
|
||||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
||||||
|
if ($pull_request_id !== 0) {
|
||||||
|
$dir = addPreviewDeploymentSuffix($dir, $pull_request_id);
|
||||||
|
}
|
||||||
if (str($source, '.')) {
|
if (str($source, '.')) {
|
||||||
$source = str($source)->replaceFirst('.', $dir);
|
$source = str($source)->replaceFirst('.', $dir);
|
||||||
}
|
}
|
||||||
if (str($source, '~')) {
|
if (str($source, '~')) {
|
||||||
$source = str($source)->replaceFirst('~', $dir);
|
$source = str($source)->replaceFirst('~', $dir);
|
||||||
}
|
}
|
||||||
if ($pull_request_id !== 0) {
|
|
||||||
$source = addPreviewDeploymentSuffix($source, $pull_request_id);
|
|
||||||
}
|
|
||||||
if ($read_only) {
|
if ($read_only) {
|
||||||
data_set($volume, 'source', $source.':'.$target.':ro');
|
data_set($volume, 'source', $source.':'.$target.':ro');
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -2650,15 +2650,15 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||||
$mount = $volume->after(':');
|
$mount = $volume->after(':');
|
||||||
if ($name->startsWith('.') || $name->startsWith('~')) {
|
if ($name->startsWith('.') || $name->startsWith('~')) {
|
||||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
||||||
|
if ($pull_request_id !== 0) {
|
||||||
|
$dir = addPreviewDeploymentSuffix($dir, $pull_request_id);
|
||||||
|
}
|
||||||
if ($name->startsWith('.')) {
|
if ($name->startsWith('.')) {
|
||||||
$name = $name->replaceFirst('.', $dir);
|
$name = $name->replaceFirst('.', $dir);
|
||||||
}
|
}
|
||||||
if ($name->startsWith('~')) {
|
if ($name->startsWith('~')) {
|
||||||
$name = $name->replaceFirst('~', $dir);
|
$name = $name->replaceFirst('~', $dir);
|
||||||
}
|
}
|
||||||
if ($pull_request_id !== 0) {
|
|
||||||
$name = addPreviewDeploymentSuffix($name, $pull_request_id);
|
|
||||||
}
|
|
||||||
$volume = str("$name:$mount");
|
$volume = str("$name:$mount");
|
||||||
} else {
|
} else {
|
||||||
if ($pull_request_id !== 0) {
|
if ($pull_request_id !== 0) {
|
||||||
|
|
@ -2718,6 +2718,9 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
||||||
$uuid = $resource->uuid;
|
$uuid = $resource->uuid;
|
||||||
if ((str($source)->startsWith('.') || str($source)->startsWith('~') || str($source)->startsWith('/'))) {
|
if ((str($source)->startsWith('.') || str($source)->startsWith('~') || str($source)->startsWith('/'))) {
|
||||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
||||||
|
if ($pull_request_id !== 0) {
|
||||||
|
$dir = addPreviewDeploymentSuffix($dir, $pull_request_id);
|
||||||
|
}
|
||||||
if (str($source, '.')) {
|
if (str($source, '.')) {
|
||||||
$source = str($source)->replaceFirst('.', $dir);
|
$source = str($source)->replaceFirst('.', $dir);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue