1
0
mirror of https://github.com/yldio/copilot.git synced 2024-11-13 06:40:06 +02:00

chore: push image after build

This commit is contained in:
Sérgio Ramos 2017-05-30 23:23:43 +01:00
parent cf5f476898
commit b7371b355a
2 changed files with 19 additions and 2 deletions

View File

@ -65,6 +65,7 @@
"lerna": "^2.0.0-rc.5",
"lerna-wizard": "ramitos/lerna-wizard#7bcdc11",
"license-to-fail": "^2.2.0",
"lodash.flatten": "^4.4.0",
"lodash.isplainobject": "^4.0.6",
"lodash.isstring": "^4.0.1",
"lodash.uniq": "^4.5.0",

View File

@ -5,8 +5,10 @@ const main = require('apr-main');
const map = require('apr-map');
const globby = require('globby');
const path = require('path');
const flatten = require('lodash.flatten');
const readPkg = require('read-pkg');
const NAMESPACE = 'quay.io/yldio';
const ROOT = path.join(__dirname, '..');
const CIRCLE_BRANCH = process.env['CIRCLE_BRANCH'];
@ -18,9 +20,23 @@ const build = async () => {
return map(dockerfiles, async dockerfile => {
const folder = path.resolve(ROOT, path.dirname(dockerfile));
const { name } = await readPkg(folder);
const tag = `${name}:${CIRCLE_BRANCH}`;
const tags = [`${name}:${CIRCLE_BRANCH}`, `${name}:latest`];
return execa('docker', ['build', '-t', tag, '-f', dockerfile, '.'], {
await execa(
'docker',
flatten([
'build',
flatten(tags.map(name => ['-t', `${NAMESPACE}/${name}`])),
'-f',
dockerfile,
'.'
]),
{
stdio: 'inherit'
}
);
return execa('push', ['push', `${NAMESPACE}/${name}`], {
stdio: 'inherit'
});
});