forked from codewars/codewars-runner-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.js
45 lines (41 loc) · 1.3 KB
/
build.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
35
36
37
38
39
40
41
42
43
44
var docker = require('./lib/docker'),
opts = require("nomnom")
.options({
image: {
abbr: 'i',
help: 'The image to build'
},
file: {
abbr: 'f',
help: 'The file to use to build the file'
},
push: {
abbr: 'p',
flag: true,
help: 'Provide if image should be pushed after being built'
},
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();
console.log('Building image, this may take a while...');
docker.build(opts.file, opts.image, function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
console.log('Image name = ' + docker.taggedImage(opts.image));
if(opts.push) {
console.log('Pushing image...');
docker.push(opts.image, function(err, stdout, stderr) {
console.log(stdout);
console.log(stderr);
console.log('Image pushed');
});
}
});