Skip to content
Snippets Groups Projects
Commit 9b25a1e4 authored by jurgenhaas's avatar jurgenhaas
Browse files

bitegra/slides#1 Enhance volume.php to allow mounting of subdirectories

parent c161d195
No related branches found
No related tags found
No related merge requests found
Pipeline #403559 passed
......@@ -21,15 +21,16 @@ function readContainerConfig() {
function getDockerMountSource($args) {
$currentDir = getcwd();
$suffix = (empty($args[2])) ? '' : '/' . $args[2];
$destDir = (empty($args[1])) ? $currentDir : $args[1];
$container = readContainerConfig();
foreach ($container['Mounts'] as $mount) {
if (strpos($currentDir, $mount['Destination']) === 0) {
return $mount['Source'] . ':' . (empty($args[1]) ? $mount['Destination'] : $destDir);
return $mount['Source'] . $suffix . ':' . (empty($args[1]) ? $mount['Destination'] : $destDir) . $suffix;
}
}
return $currentDir . ':' . $destDir;
return $currentDir . $suffix . ':' . $destDir . $suffix;
}
print(getDockerMountSource($argv));
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment