mirror of
https://github.com/yldio/copilot.git
synced 2024-12-01 07:30:07 +02:00
30 lines
760 B
Plaintext
30 lines
760 B
Plaintext
|
#!/usr/bin/env node
|
||
|
|
||
|
const execa = require('execa');
|
||
|
const main = require('apr-main');
|
||
|
const map = require('apr-map');
|
||
|
const globby = require('globby');
|
||
|
const path = require('path');
|
||
|
const readPkg = require('read-pkg');
|
||
|
|
||
|
const ROOT = path.join(__dirname, '..');
|
||
|
const CIRCLE_BRANCH = process.env['CIRCLE_BRANCH'];
|
||
|
|
||
|
const build = async () => {
|
||
|
const dockerfiles = await globby(['packages/*/Dockerfile'], {
|
||
|
cwd: ROOT
|
||
|
});
|
||
|
|
||
|
return map(dockerfiles, async dockerfile => {
|
||
|
const folder = path.resolve(ROOT, path.dirname(dockerfile));
|
||
|
const { name } = await readPkg(folder);
|
||
|
const tag = `${name}:${CIRCLE_BRANCH}`;
|
||
|
|
||
|
return execa('docker', ['build', '-t', tag, '-f', dockerfile, '.'], {
|
||
|
stdio: 'inherit'
|
||
|
});
|
||
|
});
|
||
|
};
|
||
|
|
||
|
main(build());
|