From b7371b355afc8e504239535d15b406152f86b188 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Se=CC=81rgio=20Ramos?= Date: Tue, 30 May 2017 23:23:43 +0100 Subject: [PATCH] chore: push image after build --- package.json | 1 + scripts/build | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index 5a5d6c17..a2e6dcd1 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/scripts/build b/scripts/build index 02a3230d..3c824f3a 100755 --- a/scripts/build +++ b/scripts/build @@ -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' }); });