feat: persistent storage for all services
This commit is contained in:
@@ -1622,4 +1622,30 @@ export async function cleanupDockerStorage(dockerId, lowDiskSpace, force) {
|
||||
//console.log(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function persistentVolumes(id, persistentStorage, config) {
|
||||
const persistentVolume =
|
||||
persistentStorage?.map((storage) => {
|
||||
return `${id}${storage.path.replace(/\//gi, '-')}:${storage.path}`;
|
||||
}) || [];
|
||||
|
||||
const volumes = [config.volume, ...persistentVolume]
|
||||
const composeVolumes = volumes.map((volume) => {
|
||||
return {
|
||||
[`${volume.split(':')[0]}`]: {
|
||||
name: volume.split(':')[0]
|
||||
}
|
||||
};
|
||||
});
|
||||
const volumeMounts = Object.assign(
|
||||
{},
|
||||
{
|
||||
[config.volume.split(':')[0]]: {
|
||||
name: config.volume.split(':')[0]
|
||||
}
|
||||
},
|
||||
...composeVolumes
|
||||
);
|
||||
return { volumes, volumeMounts }
|
||||
}
|
Reference in New Issue
Block a user