fix: host volumes

This commit is contained in:
Andras Bacsai
2023-03-07 10:31:10 +01:00
parent 87da27f9bf
commit 04f7e8e777
4 changed files with 40 additions and 24 deletions

View File

@@ -78,15 +78,25 @@ export default async function (data) {
if (value['volumes']?.length > 0) {
value['volumes'] = value['volumes'].map((volume) => {
let [v, path, permission] = volume.split(':');
if (!path) {
path = v;
v = `${applicationId}${v.replace(/\//gi, '-').replace(/\./gi, '')}`;
if (
v.startsWith('.') ||
v.startsWith('..') ||
v.startsWith('/') ||
v.startsWith('~')
) {
// Nothing to do here, host path
} else {
v = `${applicationId}${v.replace(/\//gi, '-').replace(/\./gi, '')}`;
if (!path) {
path = v;
v = `${applicationId}${v.replace(/\//gi, '-').replace(/\./gi, '')}`;
} else {
v = `${applicationId}${v.replace(/\//gi, '-').replace(/\./gi, '')}`;
}
composeVolumes[v] = {
name: v
};
}
composeVolumes[v] = {
name: v
};
return `${v}:${path}${permission ? ':' + permission : ''}`;
});
}