Add prepare option

This commit is contained in:
1computer1 2019-05-14 20:39:23 -04:00
parent 72454abe0f
commit a3893052cd
2 changed files with 8 additions and 4 deletions

View file

@ -11,5 +11,6 @@
], ],
"memory": "128m", "memory": "128m",
"cpus": "0.5", "cpus": "0.5",
"timeout": 10000 "timeout": 10000,
"prepare": false
} }

View file

@ -52,10 +52,13 @@ class LanguageHandler extends AkairoHandler {
} }
buildDocker() { buildDocker() {
return Promise.all(this.modules.map(({ loads }) => { return Promise.all(this.modules.map(({ id, loads }) => {
return Promise.all(loads.map(name => { return Promise.all(loads.map(async name => {
const folder = path.join(__dirname, '../../docker', name); const folder = path.join(__dirname, '../../docker', name);
return util.promisify(childProcess.exec)(`docker build -t "1computer1/comp_iler:${name}" ${folder}`); await util.promisify(childProcess.exec)(`docker build -t "1computer1/comp_iler:${name}" ${folder}`);
if (this.client.config.prepare) {
await this.setupContainer(id);
}
})); }));
})); }));
} }