diff --git a/config.example.json b/config.example.json index d533133..6f66d90 100644 --- a/config.example.json +++ b/config.example.json @@ -11,5 +11,6 @@ ], "memory": "128m", "cpus": "0.5", - "timeout": 10000 + "timeout": 10000, + "prepare": false } diff --git a/src/struct/LanguageHandler.js b/src/struct/LanguageHandler.js index a8a255b..dbfbf0a 100644 --- a/src/struct/LanguageHandler.js +++ b/src/struct/LanguageHandler.js @@ -52,10 +52,13 @@ class LanguageHandler extends AkairoHandler { } buildDocker() { - return Promise.all(this.modules.map(({ loads }) => { - return Promise.all(loads.map(name => { + return Promise.all(this.modules.map(({ id, loads }) => { + return Promise.all(loads.map(async 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); + } })); })); }