forked from apache/openwhisk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdocker.gradle
21 lines (19 loc) · 886 Bytes
/
docker.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
ext {
dockerRegistry = project.hasProperty('dockerRegistry') ? dockerRegistry + '/' : ''
dockerImageTag = project.hasProperty('dockerImageTag') ? dockerImageTag : 'latest'
}
def docker = ['docker']
if(project.hasProperty('dockerRetry')) {
docker = [file(buildscript.sourceFile).getParentFile().getAbsolutePath() + '/tools/docker/dockerWithRetry.sh', '240']
}
task distDocker(type:Exec) {
commandLine docker + ['build', '-t', dockerImageName, project.buildscript.sourceFile.getParentFile().getAbsolutePath()]
}
task tagImage(type: Exec) {
commandLine 'docker', 'tag', '-f', dockerImageName, dockerRegistry + dockerImageName + ':' + dockerImageTag
}
task pushImage(dependsOn: tagImage, type:Exec) {
commandLine docker + ['push', dockerRegistry + dockerImageName + ':' + dockerImageTag]
}
pushImage.onlyIf { dockerRegistry != '' }
distDocker.finalizedBy pushImage