-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker-compose.gradle
47 lines (37 loc) · 1.71 KB
/
docker-compose.gradle
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
buildscript {
repositories {
jcenter()
}
dependencies {
classpath "com.avast.gradle:gradle-docker-compose-plugin:0.17.7"
}
}
apply plugin: com.avast.gradle.dockercompose.DockerComposePlugin
dockerCompose {
useComposeFiles = ["$project.rootDir/$project.name/src/main/docker/docker-compose.yml"]
waitForTcpPorts = false
captureContainersOutput = false
stopContainers = true // doesn't call `docker-compose down` - see below the paragraph about reconnecting
removeContainers = true
removeImages = "Local" // Other accepted values are: "All" and "Local"
removeVolumes = true
removeOrphans = false // removes containers for services not defined in the Compose file
String scaleString = System.getProperty("DOCKER_COMPOSE_SCALE") != null ? System.getProperty("DOCKER_COMPOSE_SCALE") != null : null
scaleString = System.getenv("DOCKER_COMPOSE_SCALE") != null ? System.getenv("DOCKER_COMPOSE_SCALE") : scaleString
if (scaleString != null && scaleString.trim().size() > 0) {
for (String c : scaleString.split(",")) {
String[] e = c.split("=")
if (e.length>1) {
composeUp.settings.scale.put(e[0], e[1])
}
}
}
if (System.getProperty("DOCKER_HOST") != null) {
environment.put 'DOCKER_HOST', System.getProperty("DOCKER_HOST")
} else if (System.getenv("DOCKER_HOST") != null) {
environment.put 'DOCKER_HOST', System.getenv("DOCKER_HOST")
}
// Pass environment variable to 'docker-compose' for substitution in compose file
environment.put 'SPRING_PROFILES_ACTIVE', System.getenv("SPRING_PROFILES_ACTIVE") !=null ? System.getenv("SPRING_PROFILES_ACTIVE") : 'docker'
}
composeUp.dependsOn composeDown