-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
115 lines (96 loc) · 2.57 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
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.format.DateTimeFormatter
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
buildscript {
repositories {
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath "io.freefair.gradle:lombok-plugin:5.3.3.3"
}
}
plugins {
id 'com.bmuschko.docker-remote-api' version '3.2.3'
}
def commit = 'git rev-parse HEAD'.execute().text.trim().substring(0, 7)
println("HEAD: " + commit)
version = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy.MM.dd-HH.mm.ss")) + "-" + commit
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'io.freefair.lombok'
repositories {
flatDir {
dirs 'deps'
}
mavenCentral()
}
dependencies {
compile name: 'commons-io-2.4'
compile name: 'guava-17.0'
compile name: 'gson-2.8.0'
compile name: 'asm-debug-all-5.2'
compile 'org.slf4j:slf4j-api:2.0.7'
compile 'ch.qos.logback:logback-classic:1.3.6'
compile 'net.dv8tion:JDA:5.1.0'
compile 'org.xerial:sqlite-jdbc:3.45.2.0'
}
compileJava {
outputs.upToDateWhen { false }
options.compilerArgs << '-XDignore.symbol.file'
options.fork = true
options.forkOptions.executable = 'javac'
}
jar {
classifier = 'bin'
baseName = archivesBaseName
}
task fatJar(type: Jar, dependsOn: 'jar') {
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
inputs.file jar.archivePath
from(configurations.compile.collect { zipTree(it).matching {
exclude "META-INF/**"
} })
from("${projectDir}/services") {
into "META-INF/services"
}
classifier = 'all'
baseName = archivesBaseName
}
tasks.withType(Jar) {
doFirst {
manifest {
attributes([
"Main-Class": "com.aizistral.infmachine.Main",
"Implementation-Version": version
])
}
}
}
fatJar.doFirst {
from zipTree(jar.archivePath)
}
artifacts {
archives fatJar
}
task createDockerfile(type: Dockerfile) {
destFile = project.file('build/docker/Dockerfile')
from 'openjdk:8-jre-alpine'
maintainer 'Aizistral "admin@aizistral.com"'
copyFile fatJar.archiveName, '/infinite-machine/InfiniteMachine.jar'
runCommand 'mkdir /infinite-machine/persistence'
runCommand 'mkdir /infinite-machine/persistence/database'
runCommand 'mkdir /infinite-machine/persistence/config'
workingDir("/infinite-machine/persistence")
entryPoint 'java'
defaultCommand '-jar', '../InfiniteMachine.jar'
}
task syncWebAppArchive(type: Sync) {
dependsOn assemble
from fatJar.archivePath
into createDockerfile.destFile.parentFile
}
createDockerfile.dependsOn syncWebAppArchive
fatJar.finalizedBy createDockerfile