File tree 1 file changed +23
-0
lines changed
1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change
1
+ import com.bmuschko.gradle.docker.tasks.container.*
2
+
1
3
plugins {
2
4
id " java"
3
5
id " scala"
4
6
id " application"
5
7
id " cz.alenkacz.gradle.scalafmt" version " 1.16.2"
8
+ id ' com.bmuschko.docker-remote-api' version ' 9.0.1'
6
9
}
7
10
8
11
version = ' 1.0.2'
@@ -24,3 +27,23 @@ dependencies {
24
27
}
25
28
26
29
compileScala. dependsOn(" checkScalafmt" )
30
+
31
+ task createMongoContainer (type : DockerCreateContainer ) {
32
+ targetImageId ' mongo:3.2'
33
+ containerName = ' mongo'
34
+ hostConfig. portBindings = [' 27017:27017' ]
35
+ hostConfig. autoRemove = true
36
+ }
37
+
38
+ task startMongoContainer (type : DockerStartContainer ) {
39
+ dependsOn createMongoContainer
40
+ targetContainerId createMongoContainer. containerId
41
+ }
42
+
43
+ task stopMongoContainer (type : DockerStopContainer ) {
44
+ targetContainerId createMongoContainer. containerId
45
+ }
46
+
47
+ run. dependsOn(startMongoContainer)
48
+
49
+ run. finalizedBy(stopMongoContainer)
You can’t perform that action at this time.
0 commit comments