Skip to content

Commit 863ba27

Browse files
committedOct 18, 2019
fix(docker-compose): order of files, auto->dcm->regular
1 parent 699a4fc commit 863ba27

File tree

1 file changed

+13
-10
lines changed

1 file changed

+13
-10
lines changed
 

‎bin/cmds/test_cmds/compose.js

+13-10
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ const {
1111
} = require('shelljs');
1212

1313
const isWin = process.platform === 'win32';
14-
const withComposeFile = (filepath) => `-f ${filepath}`;
1514

1615
exports.command = 'compose';
1716
exports.desc = 'installs compose on the system';
@@ -47,28 +46,32 @@ exports.handler = (argv) => {
4746
chmod('+x', compose);
4847
}
4948

50-
let dockerComposeFiles = withComposeFile(argv.docker_compose);
49+
const originalDockerCompose = argv.docker_compose;
50+
const dockerComposeFiles = [];
51+
52+
if (argv.docker_compose_multi.length > 0) {
53+
dockerComposeFiles.push(...argv.docker_compose_multi);
54+
}
5155

5256
/**
5357
* Generates dynamic docker-compose file based on the presets
5458
*/
5559
if (argv.auto_compose) {
5660
require('./auto_compose').handler(argv);
61+
const autoComposeFile = argv.docker_compose;
5762

58-
const autoComposeFile = withComposeFile(argv.docker_compose);
63+
dockerComposeFiles.unshift(autoComposeFile);
5964
if (argv.with_local_compose) {
60-
dockerComposeFiles += ` ${autoComposeFile}`;
61-
} else {
62-
dockerComposeFiles = autoComposeFile;
65+
dockerComposeFiles.push(originalDockerCompose);
6366
}
67+
} else {
68+
dockerComposeFiles.push(originalDockerCompose);
6469
}
6570

66-
if (argv.docker_compose_multi.length > 0) {
67-
dockerComposeFiles += ` -f ${argv.docker_compose_multi.join(' -f ')}`;
68-
}
71+
const composeFiles = dockerComposeFiles.map((x) => `-f ${x}`).join(' ');
6972

7073
// add link to compose file
71-
argv.compose = ShellString(`"${compose}" ${dockerComposeFiles.trim()}`);
74+
argv.compose = ShellString(`"${compose}" ${composeFiles}`);
7275

7376
function stopDocker(signal, code) {
7477
const dockerCompose = argv.compose;

0 commit comments

Comments
 (0)
Please sign in to comment.