-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle
76 lines (65 loc) · 1.74 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
// Slimer build image and deliver
//apply plugin: 'application'
apply plugin: 'docker'
//Setup gradle-appengine plugin
buildscript {
repositories {
//maven {
// url "<your local maven registry nexus>"
//}
jcenter()
mavenCentral()
}
dependencies {
classpath 'se.transmode.gradle:gradle-docker:1.2'
}
}
repositories {
//maven {
// url "<your local maven registry nexus>"
//}
jcenter()
mavenCentral()
}
dependencies {
}
group = "slimer"
docker{
dockerBinary='docker'
}
task slimerDocker(type:Docker){
dockerfile='Dockerfile'
String cid=commitID()
setEnvironment("slimer_COMMIT_ID", cid?cid:'NA')
applicationName = 'slimer_dev'
tagVersion = getVersion()
if (System.properties['registry'] != null) {
registry = System.properties['registry']
}else{
registry = '<your default private docker registry server>'
}
tag = "${registry}/${project.group}/${applicationName}"
stageDir = project.rootDir
if (System.properties['push'] == 'true' ){
push = true
}
}
def getVersion(){
Properties version = new Properties()
File pf = new File(rootProject.getRootDir().getAbsolutePath()+'/version.ini')
pf.withInputStream {
version.load(it)
}
print version.get('VERSION_BUILD')
return String.format("%s.%s.%s",version.get('VERSION_MAJOR'),version.get('VERSION_MINOR'),version.get('VERSION_BUILD'))
}
def commitID() {
def stdout = new ByteArrayOutputStream()
exec {
//commandLine 'git', 'show', '-s', '--pretty=oneline'
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
ignoreExitValue = true
}
return stdout.toString().trim()
}