Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions lib/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ Docker.prototype.buildImage = function(file, opts, callback) {
optsf.authconfig = optsf.options.authconfig;
delete optsf.options.authconfig;
}

if (opts.cachefrom && Array.isArray(opts.cachefrom)) {
optsf.options.cachefrom = JSON.stringify(opts.cachefrom);
}
}

function dial(callback) {
Expand Down
22 changes: 22 additions & 0 deletions test/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,28 @@ describe("#docker", function() {
}, { t: 'multiple-files' }, handler);
});

it("should build image from multiple files using cache", function(done) {
this.timeout(60000);

function handler(err, stream) {
expect(err).to.be.null;
expect(stream).to.be.ok;

stream.pipe(process.stdout, {
end: true
});

stream.on('end', function() {
done();
});
}

docker.buildImage({
context: __dirname,
src: ['Dockerfile']
}, { t: 'multiple-files-cachefrom', 'cachefrom': ['ubuntu:latest'] }, handler);
});

it("should build image from multiple files while respecting the .dockerignore file", function(done) {
this.timeout(60000);

Expand Down