-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
110 lines (88 loc) · 2.33 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
plugins {
id "eu.xenit.docker" version "5.3.0" apply false // Have a look at the releases to find the latest one
}
project(':9.5') {
project.ext {
baseImage = 'postgres:9.5.25'
tags = ['9.5', '9.5.25']
}
}
project(':9.6') {
project.ext {
baseImage = 'postgres:9.6.23'
tags = ['9', '9.6', '9.6.23']
}
}
project(':10') {
project.ext {
baseImage = 'postgres:10.18'
tags = ['10', '10.18']
}
}
project(':11') {
project.ext {
baseImage = 'postgres:11.13'
tags = ['11', '11.13']
}
}
project(':12') {
project.ext {
baseImage = 'postgres:12.8'
tags = ['12', '12.8']
}
}
project(':13') {
project.ext {
baseImage = 'postgres:13.4'
tags = ['13', '13.4', 'latest']
}
}
subprojects {
project.projectDir.mkdir()
project.ext {
pgVersion = project.projectDir.name
walgVersion = 'v0.2.19'
}
apply plugin: 'eu.xenit.docker'
apply plugin: 'eu.xenit.docker-compose'
apply plugin: 'java'
repositories {
mavenCentral()
}
dependencies {
testImplementation group: 'junit', name: 'junit', version: '4.13.2'
testImplementation group: 'org.postgresql', name: 'postgresql', version: '42.2.19'
}
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceSets {
test {
java {
srcDirs "$project.parent.projectDir/src/test/java"
}
}
}
task copyDocker(type: Copy) {
from file("$project.parent.projectDir/src/main/docker")
into "$project.buildDir/docker"
}
buildDockerImage.dependsOn(copyDocker)
docker {
registryCredentials {
username = System.getenv("DOCKER_USER")
password = System.getenv("DOCKER_PASSWORD")
}
}
dockerBuild {
dockerFile = file("$copyDocker.destinationDir/Dockerfile")
repositories = ['xenit/postgres']
tags = project.tags
}
dockerCompose {
useComposeFiles = ["$project.parent.projectDir/src/main/compose/docker-compose.yml"]
}
buildDockerImage {
buildArgs = ['PGVERSION': project.pgVersion, 'BASEIMAGE': project.baseImage, 'WALGVERSION': project.walgVersion]
}
dockerCompose.isRequiredBy(test)
}