Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
new Promise(async resolve => {
// create tar streams
const streamDocker = tar.pack(path.join(__dirname, 'fixtures', 'docker-project'));
const streamNode = tar.pack(path.join(__dirname, 'fixtures', 'node-project'));
const streamHtml = tar.pack(path.join(__dirname, 'fixtures', 'html-project'));
const streamHtmlUpdate = tar.pack(path.join(__dirname, 'fixtures', 'html-project'));
const streamCompose = tar.pack(path.join(__dirname, 'fixtures', 'compose-project'));
const streamComposeUpdate = tar.pack(path.join(__dirname, 'fixtures', 'compose-project'));
const streamBrokenDocker = tar.pack(path.join(__dirname, 'fixtures', 'broken-docker-project'));
const streamBrokenNode = tar.pack(path.join(__dirname, 'fixtures', 'broken-node-project'));
// options base
const optionsBase = {
method: 'POST',
url: '/deploy',
headers: {
Authorization: `Bearer ${token}`,
},
};
.forEach(value => {
const file = value.name.replace(/{hash}/, value.hash);
content = content.replace(value.name, file);
});
// add hash to theme specific files
themes.forEach(theme => {
const appHash = hash(values,'bundle_app_{hash}', theme);
const vendorHash = hash(values, 'bundle_vendor_{hash}', theme);
let body;
body = template.replace(/{theme}/g, theme);
body = body.replace(/{app_hash}/, appHash);
themeSpecific.push(body.replace(/{vendor_hash}/, vendorHash));
});
content = content.replace(/{theme_specific}/, themeSpecific.join('\n'));
writeDesktop(content);
tar.pack(distDir).pipe(zlib.createGzip()).pipe(output);
console.log('Done');
},
error => {
_build () {
const files = ['Dockerfile', 'requirements.txt', 'src/preload.py']
const name = 'Building Docker preloader image.'
this._progress(name, 0)
const tarStream = tarfs.pack(path.resolve(__dirname, '..'), { entries: files })
return this.docker.buildImage(tarStream, { t: DOCKER_IMAGE_TAG })
.then((build) => {
return new Promise((resolve, reject) => {
this.docker.modem.followProgress(
build,
(error, output) => { // onFinished
if (error) {
reject(error)
} else {
this._progress(name, 100)
resolve()
}
},
(event) => { // onProgress
if (event.stream) {
const matches = event.stream.match(DOCKER_STEP_RE)
test('deploy', function (t) {
var tarstream = tar.pack(path.join(__dirname, 'example-site'))
var options = { domain: 'hi.com', authorization: `Bearer ${token}` }
staticland.deploy(tarstream, options, function (err, res, body) {
t.notOk(err)
t.ok(res)
t.ok(body)
t.end()
})
})
public async buildImage(repoTag: RepoTag, context: BuildContext, buildArgs: BuildArgs): Promise {
log.info(`Building image '${repoTag.toString()}' with context '${context}'`);
const tarStream = tar.pack(context);
const stream = await this.dockerode.buildImage(tarStream, {
buildargs: buildArgs,
t: repoTag.toString()
});
await streamToArray(stream);
}
return new Promise(function (resolve, reject) {
self._docker.buildImage(Tar.pack(self._dirPath), {t: self.config.tag}, function (err, stream){
if(err) { return reject(err); }
stream.on('end', function () {
self.log('Build Image with Tag: ' + self.config.tag);
resolve();
});
stream.on('data', function (data) {
try {
var output = JSON.parse(data.toString());
if(output.stream) {
self.log(output.stream);
}
} catch (e) {
}
});
});
function copyRecursive (src, dst, cb) {
pump(tar.pack(src), tar.extract(dst), cb)
}