diff --git a/lib/docker.js b/lib/docker.js index dfaad04..e1cffbf 100644 --- a/lib/docker.js +++ b/lib/docker.js @@ -251,7 +251,7 @@ Docker.prototype.checkAuth = function(opts, callback) { Docker.prototype.buildImage = function(file, opts, callback) { var self = this; var content; - var pack; + var pack = tar.pack(); if (!callback && typeof opts === 'function') { callback = opts; @@ -304,26 +304,7 @@ Docker.prototype.buildImage = function(file, opts, callback) { pack = tar.pack(file.context, { entries: file.src }); - - if (callback === undefined) { - return new self.modem.Promise(function(resolve, reject) { - pack.on('error', function(error) { - return reject(error); - }); - pack.on('end', function() { - return resolve(build(stream)); - }); - var stream = pack.pipe(zlib.createGzip()); - }); - } else { - pack.on('error', function(error) { - return callback(error); - }); - pack.on('end', function() { - return build(stream); - }); - var stream = pack.pipe(zlib.createGzip()); - } + return build(pack.pipe(zlib.createGzip())); } else { return build(file); }