mirror of
https://github.com/coollabsio/coolify.git
synced 2026-03-11 08:55:47 +00:00
bind correct directories to preview deployment docker compose containers
This commit is contained in:
parent
021605dbf0
commit
d36bc84b5d
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->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->container_name = generateApplicationContainerName($this->application, $this->pull_request_id);
|
||||
|
|
@ -755,6 +759,9 @@ class ApplicationDeploymentJob implements ShouldBeEncrypted, ShouldQueue
|
|||
|
||||
// Start compose file
|
||||
$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->docker_compose_custom_start_command) {
|
||||
// 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 {
|
||||
$mainDirectory = str(base_configuration_dir().'/applications/'.$uuid);
|
||||
}
|
||||
$source = replaceLocalSource($source, $mainDirectory);
|
||||
if ($isPullRequest) {
|
||||
$source = addPreviewDeploymentSuffix($source, $pull_request_id);
|
||||
$mainDirectory = str(addPreviewDeploymentSuffix($mainDirectory, $pull_request_id));
|
||||
}
|
||||
$source = replaceLocalSource($source, $mainDirectory);
|
||||
LocalFileVolume::updateOrCreate(
|
||||
[
|
||||
'mount_path' => $target,
|
||||
|
|
|
|||
|
|
@ -2165,15 +2165,15 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||
$mount = $volume->after(':');
|
||||
if ($name->startsWith('.') || $name->startsWith('~')) {
|
||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
||||
if ($pull_request_id !== 0) {
|
||||
$dir = addPreviewDeploymentSuffix($dir, $pull_request_id);
|
||||
}
|
||||
if ($name->startsWith('.')) {
|
||||
$name = $name->replaceFirst('.', $dir);
|
||||
}
|
||||
if ($name->startsWith('~')) {
|
||||
$name = $name->replaceFirst('~', $dir);
|
||||
}
|
||||
if ($pull_request_id !== 0) {
|
||||
$name = addPreviewDeploymentSuffix($name, $pull_request_id);
|
||||
}
|
||||
$volume = str("$name:$mount");
|
||||
} else {
|
||||
if ($pull_request_id !== 0) {
|
||||
|
|
@ -2228,15 +2228,15 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||
if ($source && $target) {
|
||||
if ((str($source)->startsWith('.') || str($source)->startsWith('~'))) {
|
||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
||||
if ($pull_request_id !== 0) {
|
||||
$dir = addPreviewDeploymentSuffix($dir, $pull_request_id);
|
||||
}
|
||||
if (str($source, '.')) {
|
||||
$source = str($source)->replaceFirst('.', $dir);
|
||||
}
|
||||
if (str($source, '~')) {
|
||||
$source = str($source)->replaceFirst('~', $dir);
|
||||
}
|
||||
if ($pull_request_id !== 0) {
|
||||
$source = addPreviewDeploymentSuffix($source, $pull_request_id);
|
||||
}
|
||||
if ($read_only) {
|
||||
data_set($volume, 'source', $source.':'.$target.':ro');
|
||||
} else {
|
||||
|
|
@ -2289,15 +2289,15 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||
$mount = $volume->after(':');
|
||||
if ($name->startsWith('.') || $name->startsWith('~')) {
|
||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
||||
if ($pull_request_id !== 0) {
|
||||
$dir = addPreviewDeploymentSuffix($dir, $pull_request_id);
|
||||
}
|
||||
if ($name->startsWith('.')) {
|
||||
$name = $name->replaceFirst('.', $dir);
|
||||
}
|
||||
if ($name->startsWith('~')) {
|
||||
$name = $name->replaceFirst('~', $dir);
|
||||
}
|
||||
if ($pull_request_id !== 0) {
|
||||
$name = addPreviewDeploymentSuffix($name, $pull_request_id);
|
||||
}
|
||||
$volume = str("$name:$mount");
|
||||
} else {
|
||||
if ($pull_request_id !== 0) {
|
||||
|
|
@ -2357,6 +2357,9 @@ function parseDockerComposeFile(Service|Application $resource, bool $isNew = fal
|
|||
$uuid = $resource->uuid;
|
||||
if ((str($source)->startsWith('.') || str($source)->startsWith('~') || str($source)->startsWith('/'))) {
|
||||
$dir = base_configuration_dir().'/applications/'.$resource->uuid;
|
||||
if ($pull_request_id !== 0) {
|
||||
$dir = addPreviewDeploymentSuffix($dir, $pull_request_id);
|
||||
}
|
||||
if (str($source, '.')) {
|
||||
$source = str($source)->replaceFirst('.', $dir);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue