-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
124 lines (105 loc) · 3.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
plugins {
id 'java'
id "io.toolebox.git-versioner" version "1.6.7"
}
group = 'com.github.nagyesta'
project.ext {
gitUser = project.hasProperty('githubUser') ? (project.property('githubUser') as String) : ''
gitToken = project.hasProperty('githubToken') ? (project.property('githubToken') as String) : ''
repoUrl = 'https://github.com/nagyesta/lowkey-vault-docker-buildx'
licenseName = 'MIT License'
licenseUrl = 'https://raw.githubusercontent.com/nagyesta/lowkey-vault-docker-buildx/main/LICENSE'
maintainerId = 'nagyesta'
maintainerName = 'Istvan Zoltan Nagy'
maintainerUrl = 'https://github.com/nagyesta/'
}
versioner {
startFrom {
major = 0
minor = 0
patch = 1
}
match {
major = '{major}'
minor = '{minor}'
patch = '{patch}'
}
pattern {
//force using the version from the Lowkey Vault jar
pattern = libs.versions.lowkeyVault.get()
}
git {
authentication {
https {
token = project.ext.gitToken
}
}
}
tag {
prefix = 'v'
useCommitMessage = true
}
}
repositories {
mavenCentral()
}
configurations {
lowkey
}
dependencies {
//noinspection DependencyNotationArgument
lowkey libs.lowkey.vault.app
}
java {
sourceCompatibility = JavaVersion.VERSION_17
}
tasks.register("copyDockerfile", Copy) {
inputs.file("src/docker/Dockerfile")
outputs.file(layout.buildDirectory.file("docker/Dockerfile").get().asFile)
from file("src/docker/Dockerfile")
into layout.buildDirectory.dir("docker").get().asFile
rename {
"Dockerfile"
}
dependsOn(":build")
}
tasks.register("prepareDocker", Copy) {
inputs.file(configurations.lowkey.asFileTree.singleFile)
outputs.file(layout.buildDirectory.file("docker/lowkey-vault.jar").get().asFile)
from configurations.lowkey.asFileTree.singleFile
into layout.buildDirectory.dir("docker").get().asFile
rename {
"lowkey-vault.jar"
}
dependsOn(":copyDockerfile")
}
tasks.register('createDockerBuildx', Exec) {
workingDir layout.buildDirectory.dir("docker").get().asFile
commandLine "docker", "buildx", "create", "--use"
standardOutput = new ByteArrayOutputStream()
ext.output = {
return standardOutput.toString()
}
dependsOn(":prepareDocker")
}
tasks.register("buildDocker", Exec) {
inputs.dir(layout.buildDirectory.dir("docker").get().asFile)
workingDir layout.buildDirectory.dir("docker").get().asFile
commandLine "docker", "buildx", "build", "--platform", "linux/arm64,linux/amd64",
"--pull", "-t", "nagyesta/lowkey-vault:${libs.versions.lowkeyVault.get()}-ubi9-minimal", "."
standardOutput = new ByteArrayOutputStream()
ext.output = {
return standardOutput.toString()
}
dependsOn(":createDockerBuildx")
}
tasks.register("buildDockerPush", Exec) {
inputs.dir(layout.buildDirectory.dir("docker").get().asFile)
workingDir layout.buildDirectory.dir("docker").get().asFile
commandLine "docker", "buildx", "build", "--platform", "linux/arm64,linux/amd64",
"--push", "-t", "nagyesta/lowkey-vault:${libs.versions.lowkeyVault.get()}-ubi9-minimal", "."
standardOutput = new ByteArrayOutputStream()
ext.output = {
return standardOutput.toString()
}
}