UNPKG

mediacentral-publish

Version:

A publish tool for publishing cloud-ux projects

33 lines (28 loc) 1.68 kB
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } const { execSync } = require('child_process'); const { join } = require('path'); const logger = require.main.require('log4js').getLogger(`mediacentral-publish ${__filename}`); const buildDockerImageService = require('../buildDockerServiceImage/index'); /** * @param {String} path must be absolute * @param {String} dir * @param {String} appName * @param {String} version * @param {String} organization * @param {String} https_proxy * @returns {{file: String}} file is path to outputed saved docker image. */ module.exports = (() => { var _ref = _asyncToGenerator(function* (path, dir, appName, version, organization, https_proxy) { const image = yield buildDockerImageService(path, dir, appName, version, organization, https_proxy); const output = join(path, `${appName}-${version}-images.tar`); logger.trace(`Saving Docker Image with command: \n docker save --output "${output}" "${image.file}"`); execSync(`docker save --output "${output}" "${image.file}"`); return { file: output }; }); return function (_x, _x2, _x3, _x4, _x5, _x6) { return _ref.apply(this, arguments); }; })();