-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
71 lines (52 loc) · 1.91 KB
/
gulpfile.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//sometimes need this on mac.
//eval "$(docker-machine env default)"
var gulp = require('gulp');
var {restore, build, test, pack, publish} = require('gulp-dotnet-cli');
var run = require('gulp-run');
var Docker = require('dockerode');
gulp.task('dotnet:publish',["dotnet:build", "bower:install"], ()=>{
return gulp.src('src/WebApplicationBasic.fsproj', {read: false})
.pipe(publish());
})
gulp.task('dotnet:build',["dotnet:restore"], ()=>{
return gulp.src('src/WebApplicationBasic.fsproj', {read: false})
.pipe(build());
})
gulp.task('dotnet:restore', ()=>{
return gulp.src('src/WebApplicationBasic.fsproj', {read: false})
.pipe(restore());
})
gulp.task('bower:install',()=>{
return run('bower install ./src').exec()
.pipe(gulp.dest('output')) ;
} )
gulp.task('docker:compose',["dotnet:publish"], ()=>{
return run('docker-compose build').exec()
.pipe(gulp.dest('output')) ;
} )
gulp.task('docker:start',["docker:stop"], ()=>{
return run('docker run -t -P -d aspnetcore_fsharp_docker').exec()
.pipe(gulp.dest('output'));
});
gulp.task('docker:full',["docker:compose"], ()=>{
return gulp.start("docker:start");
});
gulp.task('docker:stop', (cb)=>{
var docker = new Docker();
var p = new Promise((good, bad)=>{
docker.listContainers(function (err, containers) {
var promises = [];
for(var i in containers){
var containerInfo = containers[i];
promises.push(new Promise((dockerGood, dockerBad)=>{
docker.getContainer(containerInfo.Id).stop(dockerGood);
console.log("Stopped container: " +containerInfo.Id);
}));
}
Promise.all(promises).then(good);
});
});
p.then(()=>{
cb();
});
});