Skip to content

Commit a7c05b8

Browse files
committed
Fixing auto copy of volumes
1 parent c31bf24 commit a7c05b8

File tree

5 files changed

+14
-7
lines changed

5 files changed

+14
-7
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ Volumes listed in `iobBackup` are tagged for inclusion in ioBroker backup routin
180180
-->
181181

182182
## Changelog
183-
### 0.0.24 (2025-10-09)
183+
### **WORK IN PROGRESS**
184184
- (@GermanBluefox) Split the docker manager into pure docker commands and monitoring of own containers
185185

186186
### 0.0.3 (2025-09-25)

eslint.config.mjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ export default [
1212
'test/**/*.js',
1313
'*.config.mjs',
1414
'build/**/*',
15+
'node_modules/**/*',
1516
'admin/build',
1617
'admin/words.js',
1718
'admin/admin.d.ts',

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
"scripts": {
2424
"postbuild": "esm2cjs --in build/esm --out build/cjs -l error -t node18 && node tasks",
2525
"build": "tsc -p tsconfig.build.json && npm run postbuild",
26+
"lint": "eslint -c eslint.config.mjs",
2627
"prepublishOnly": "npm run build",
2728
"test": "mocha --exit",
2829
"release": "release-script",

src/lib/compose2config.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -428,18 +428,26 @@ export function composeServiceToContainerConfig(serviceName: string | undefined,
428428
});
429429
}
430430
const iobCopyVolumes = labels?.iobCopyVolumes?.split(',').map(m => {
431-
const parts = m.trim().split('=>');
431+
let force = false;
432+
if (m.includes('(force)')) {
433+
m = m.replace('(force)', '');
434+
force = true;
435+
}
436+
const parts = m.trim().split('->');
432437
return {
433438
source: parts[0].trim(),
434439
target: parts[1]?.trim() || parts[0].trim(),
440+
force,
435441
};
436442
});
443+
437444
if (iobCopyVolumes) {
438445
mounts?.forEach(m => {
439446
const source = m.source === true ? 'true' : m.source;
440447
const copyInstruction = iobCopyVolumes.find(c => c.target === source);
441448
if (copyInstruction) {
442-
m.iobCopyVolume = copyInstruction.source;
449+
m.iobAutoCopyFrom = copyInstruction.source;
450+
m.iobAutoCopyFromForce = copyInstruction.force;
443451
}
444452
});
445453
}

src/types.d.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -364,15 +364,12 @@ export interface VolumeMount {
364364
size?: number; // bytes
365365
mode?: number; // e.g. 1777
366366
};
367-
/** ioBroker custom: if true, the folder will be copied into newly created volume */
367+
/** If set, this folder will be copied from host (iobAutoCopyFrom - folder) into container (only for type: "volume") */
368368
iobAutoCopyFrom?: string;
369369
/** Copy files from host to volume even if volume is not empty */
370370
iobAutoCopyFromForce?: boolean;
371371
/** If this folder should be "backup"ed by ioBroker */
372372
iobBackup?: boolean;
373-
374-
/** If set, this folder will be copied from host (iobCopyVolume - folder) into container (only for type: "volume") */
375-
iobCopyVolume?: string;
376373
}
377374

378375
export interface Resources {

0 commit comments

Comments
 (0)