mirror of
https://github.com/yldio/copilot.git
synced 2024-11-28 14:10:04 +02:00
30 lines
760 B
JavaScript
Executable File
30 lines
760 B
JavaScript
Executable File
#!/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());
|