forked from codewars/codewars-runner-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpull.js
30 lines (27 loc) · 979 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
//! 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({
image: {
abbr: 'i',
help: 'The image to pull. No tag needed, it will automatically be appended. If empty the default will be used.'
},
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();
docker.pull(opts.image, function(err, stdout, stderr) {
console.log(JSON.stringify({
docker: stdout || stderr,
version: config.version,
image: docker.taggedImage()
}));
});