File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
src/main/groovy/com/avast/gradle/dockercompose Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ dockerCompose {
5050 // removeContainers = false
5151 // removeImages = "None" // Other accepted values are: "All" and "Local"
5252 // removeVolumes = false
53+ // projectName = 'my-project' // allow to set custom docker-compose project name (defaults to directory name)
5354 // environment.put 'BACKEND_ADDRESS', '192.168.1.100' // Pass environment variable to 'docker-compose' for substitution in compose file
5455}
5556
Original file line number Diff line number Diff line change @@ -26,6 +26,7 @@ class ComposeExtension {
2626 Duration waitAfterHealthyStateProbeFailure = Duration . ofSeconds(5 )
2727 Duration waitForHealthyStateTimeout = Duration . ofMinutes(15 )
2828 List<String > useComposeFiles = []
29+ String projectName = null
2930
3031 boolean stopContainers = true
3132 boolean removeContainers = true
@@ -74,12 +75,15 @@ class ComposeExtension {
7475 }
7576
7677 /**
77- * Composes docker-compose command, mainly adds '-f' options when `useComposeFiles` is set .
78+ * Composes docker-compose command, mainly adds '-f' and '-p' options .
7879 */
7980 @PackageScope
8081 Iterable<String > composeCommand (String ... args ) {
8182 def res = [' docker-compose' ]
8283 res. addAll(useComposeFiles. collectMany { [' -f' , it] })
84+ if (projectName) {
85+ res. addAll([' -p' , projectName])
86+ }
8387 res. addAll(args)
8488 res
8589 }
You can’t perform that action at this time.
0 commit comments