mirror of
https://github.com/nextcloud/all-in-one.git
synced 2026-05-30 15:30:08 +00:00
Merge pull request #7928 from nextcloud/copilot/add-hardware-transcoding-talk-recording
talk-recording: allow to enable hardware transcoding for the container
This commit is contained in:
@@ -279,6 +279,10 @@ class ConfigurationManager
|
||||
set { $this->set('nextcloud_enable_dri_device', $value); }
|
||||
}
|
||||
|
||||
public string $driDeviceGid {
|
||||
get => getenv('NEXTCLOUD_DRI_GID') ?: '';
|
||||
}
|
||||
|
||||
public bool $enableNvidiaGpu {
|
||||
get => $this->booleanize($this->getEnvironmentalVariableOrConfig('NEXTCLOUD_ENABLE_NVIDIA_GPU', 'enable_nvidia_gpu', ''));
|
||||
set { $this->set('enable_nvidia_gpu', $value); }
|
||||
|
||||
@@ -311,17 +311,31 @@ readonly class DockerActionManager {
|
||||
}
|
||||
|
||||
$devices = [];
|
||||
$groupAdd = [];
|
||||
foreach ($container->devices as $device) {
|
||||
if ($device === '/dev/dri' && !$this->configurationManager->nextcloudEnableDriDevice) {
|
||||
continue;
|
||||
}
|
||||
$devices[] = ["PathOnHost" => $device, "PathInContainer" => $device, "CgroupPermissions" => "rwm"];
|
||||
if ($device === '/dev/dri') {
|
||||
// Add the render device's group as a supplemental group so that non-root
|
||||
// containers (e.g. nextcloud-aio-talk-recording) can access the device.
|
||||
// The GID is detected during mastercontainer startup when /dev/dri is bind-mounted.
|
||||
$gid = $this->configurationManager->driDeviceGid;
|
||||
if ($gid !== '' && !in_array($gid, $groupAdd, true)) {
|
||||
$groupAdd[] = $gid;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (count($devices) > 0) {
|
||||
$requestBody['HostConfig']['Devices'] = $devices;
|
||||
}
|
||||
|
||||
if (count($groupAdd) > 0) {
|
||||
$requestBody['HostConfig']['GroupAdd'] = $groupAdd;
|
||||
}
|
||||
|
||||
if ($container->enableNvidiaGpu && $this->configurationManager->enableNvidiaGpu) {
|
||||
$requestBody['HostConfig']['Runtime'] = 'nvidia';
|
||||
$requestBody['HostConfig']['DeviceRequests'] = [
|
||||
|
||||
Reference in New Issue
Block a user