-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
48 lines (41 loc) · 1.56 KB
/
build.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
48
buildscript {
repositories {
mavenCentral()
jcenter()
}
}
plugins {
id 'com.bmuschko.docker-remote-api' version '4.7.1'
}
repositories {
mavenCentral()
}
ext {
// Docker Label Variables
dkrLabelCommit = project.hasProperty('dkrLabelCommit') ? dkrLabelCommit : '--empty--'
dkrLabelDate = project.hasProperty('dkrLabelDate') ? dkrLabelDate : '--empty--'
dkrLabelVersion = project.hasProperty('dkrLabelVersion') ? dkrLabelVersion : version
dkrLabelDesc = project.hasProperty('dkrLabelDesc') ? dkrLabelDesc : ''
dkrLabelSummary = project.hasProperty('dkrLabelSummary') ? dkrLabelSummary : '--empty--'
dkrLabelVendor = project.hasProperty('dkrLabelVendor') ? dkrLabelVendor : '--empty--'
dkrLabelName = project.hasProperty('dkrLabelName') ? dkrLabelName : '--empty--'
}
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
task dockerBuild(type: DockerBuildImage) {
group 'distribution'
description 'Creates the Docker image'
if (!project.hasProperty("repo")) {
throw new StopExecutionException("Must provide repository location (eg. 'gcr.io/your_repo') with '-Prepo=<repoName>' argument")
}
tags.add("${repo}/${project.name}:${dkrLabelVersion}")
buildArgs.put("VERSION", "${dkrLabelVersion}")
buildArgs.put("LASTCOMMIT", "${dkrLabelCommit}")
buildArgs.put("BUILDTIME", "${dkrLabelDate}")
buildArgs.put("NAME", "${dkrLabelName}")
buildArgs.put("VENDOR", "${dkrLabelVendor}")
buildArgs.put("SUMMARY", "${dkrLabelSummary}")
buildArgs.put("DESC", "${dkrLabelDesc}")
inputDir = file(".")
pull = true
noCache = true
}