mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-02-23 21:36:19 +08:00
allow to specify read_only root FS in containers definition
Signed-off-by: Simon L <szaimen@e.mail.de>
This commit is contained in:
parent
27d99efebf
commit
cf1efa9bb0
4 changed files with 18 additions and 0 deletions
|
@ -121,6 +121,9 @@
|
|||
"minlength": 1
|
||||
}
|
||||
},
|
||||
"read_only": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"volumes": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
|
|
@ -30,6 +30,7 @@ class Container {
|
|||
/** @var string[] */
|
||||
private array $backupVolumes;
|
||||
private array $nextcloudExecCommands;
|
||||
private bool $readOnlyRootFs;
|
||||
private DockerActionManager $dockerActionManager;
|
||||
|
||||
public function __construct(
|
||||
|
@ -50,6 +51,7 @@ class Container {
|
|||
bool $apparmorUnconfined,
|
||||
array $backupVolumes,
|
||||
array $nextcloudExecCommands,
|
||||
bool $readOnlyRootFs,
|
||||
DockerActionManager $dockerActionManager
|
||||
) {
|
||||
$this->identifier = $identifier;
|
||||
|
@ -69,6 +71,7 @@ class Container {
|
|||
$this->apparmorUnconfined = $apparmorUnconfined;
|
||||
$this->backupVolumes = $backupVolumes;
|
||||
$this->nextcloudExecCommands = $nextcloudExecCommands;
|
||||
$this->readOnlyRootFs = $readOnlyRootFs;
|
||||
$this->dockerActionManager = $dockerActionManager;
|
||||
}
|
||||
|
||||
|
@ -88,6 +91,10 @@ class Container {
|
|||
return $this->restartPolicy;
|
||||
}
|
||||
|
||||
public function GetReadOnlySetting() : bool {
|
||||
return $this->readOnlyRootFs;
|
||||
}
|
||||
|
||||
public function GetShmSize() : int {
|
||||
return $this->shmSize;
|
||||
}
|
||||
|
|
|
@ -254,6 +254,11 @@ class ContainerDefinitionFetcher
|
|||
$nextcloudExecCommands = $entry['nextcloud_exec_commands'];
|
||||
}
|
||||
|
||||
$readOnlyRootFs = false;
|
||||
if (isset($entry['read_only'])) {
|
||||
$readOnlyRootFs = $entry['read_only'];
|
||||
}
|
||||
|
||||
$containers[] = new Container(
|
||||
$entry['container_name'],
|
||||
$displayName,
|
||||
|
@ -272,6 +277,7 @@ class ContainerDefinitionFetcher
|
|||
$apparmorUnconfined,
|
||||
$backupVolumes,
|
||||
$nextcloudExecCommands,
|
||||
$readOnlyRootFs,
|
||||
$this->container->get(DockerActionManager::class)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -377,6 +377,8 @@ class DockerActionManager
|
|||
}
|
||||
|
||||
$requestBody['HostConfig']['RestartPolicy']['Name'] = $container->GetRestartPolicy();
|
||||
|
||||
$requestBody['HostConfig']['ReadonlyRootfs'] = $container->GetReadOnlySetting();
|
||||
|
||||
$exposedPorts = [];
|
||||
if ($container->GetInternalPort() !== 'host') {
|
||||
|
|
Loading…
Reference in a new issue