allow to add tmpfs

Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
Simon L 2023-06-19 13:04:39 +02:00
parent a8ed5d3dc8
commit a1727d3f4f
4 changed files with 25 additions and 0 deletions

View file

@ -31,6 +31,7 @@ class Container {
private array $backupVolumes;
private array $nextcloudExecCommands;
private bool $readOnlyRootFs;
private array $tmpfs;
private DockerActionManager $dockerActionManager;
public function __construct(
@ -52,6 +53,7 @@ class Container {
array $backupVolumes,
array $nextcloudExecCommands,
bool $readOnlyRootFs,
array $tmpfs,
DockerActionManager $dockerActionManager
) {
$this->identifier = $identifier;
@ -72,6 +74,7 @@ class Container {
$this->backupVolumes = $backupVolumes;
$this->nextcloudExecCommands = $nextcloudExecCommands;
$this->readOnlyRootFs = $readOnlyRootFs;
$this->tmpfs = $tmpfs;
$this->dockerActionManager = $dockerActionManager;
}
@ -111,6 +114,10 @@ class Container {
return $this->secrets;
}
public function GetTmpfs() : array {
return $this->tmpfs;
}
public function GetDevices() : array {
return $this->devices;
}

View file

@ -267,6 +267,11 @@ class ContainerDefinitionFetcher
$readOnlyRootFs = $entry['read_only'];
}
$tmpfs = [];
if (isset($entry['tmpfs'])) {
$tmpfs = $entry['tmpfs'];
}
$containers[] = new Container(
$entry['container_name'],
$displayName,
@ -286,6 +291,7 @@ class ContainerDefinitionFetcher
$backupVolumes,
$nextcloudExecCommands,
$readOnlyRootFs,
$tmpfs,
$this->container->get(DockerActionManager::class)
);
}

View file

@ -430,6 +430,11 @@ class DockerActionManager
$requestBody['HostConfig']['ShmSize'] = $shmSize;
}
$tmpfs = $container->GetTmpfs();
if (count($tmpfs) > 0) {
$requestBody['HostConfig']['Tmpfs'] = $tmpfs;
}
$capAdds = $container->GetCapAdds();
if (count($capAdds) > 0) {
$requestBody['HostConfig']['CapAdd'] = $capAdds;