forked from codewars/codewars-runner-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpull.js
36 lines (31 loc) · 984 Bytes
/
pull.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
//! Simple utility for pulling latest docker image with version tagged, returns JSON containing details
var docker = require('./lib/docker'),
config = require('./lib/config'),
opts = require("nomnom")
.options({
version: {
abbr: 'v',
flag: true,
help: 'Print version and exit',
callback: function () {
return config.version
}
}
})
.help('This utility will rebuild the docker image for the latest version')
.parse();
var results = {version: config.version, runners: {}};
docker.imageChain(opts._, function(name, image, next)
{
console.log("Pulling " + image);
docker.pull(image, function(err, stdout, stderr) {
results.runners[name] = {
output: stdout || stderr,
image: image
}
next();
});
}).run(function()
{
console.log(JSON.stringify(results));
});