mediacentral-publish
Version:
A publish tool for publishing cloud-ux projects
32 lines (27 loc) • 1.62 kB
JavaScript
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 buildDockerImage = require('../buildDockerImage/index');
/**
* @param {String} path must be absolute
* @param {String} dir
* @param {String} appName
* @param {String} version
* @param {String} organization
* @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 buildDockerImage(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);
};
})();