forked from getodk/aggregate
-
Notifications
You must be signed in to change notification settings - Fork 0
/
docker.gradle
52 lines (42 loc) · 2.66 KB
/
docker.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
import static org.opendatakit.aggregate.gradle.Util.setPropertiesValue
import static org.opendatakit.aggregate.gradle.Util.getVersionName
String buildTarget = "${buildDir}/docker".toString()
String classRoot = "${buildTarget}/webapps/ROOT/WEB-INF/classes".toString()
task dockerClean() {
delete "${buildTarget}"
}
task dockerPrepare(dependsOn: [dockerClean], type: Copy) {
into "${buildTarget}"
from fileTree(dir: 'docker')
into('webapps/ROOT') {
from zipTree("${buildDir}/libs/${archivesBaseName}-${version}.war")
}
doLast {
file("${classRoot}/jdbc.properties.example").renameTo(file("${classRoot}/jdbc.properties"))
file("${classRoot}/security.properties.example").renameTo(file("${classRoot}/security.properties"))
file("${classRoot}/odk-settings.xml.example").renameTo(file("${classRoot}/odk-settings.xml"))
setPropertiesValue("${classRoot}/jdbc.properties", "jdbc.url", "jdbc:postgresql://127.0.0.1/aggregate?autoDeserialize=true")
setPropertiesValue("${classRoot}/jdbc.properties", "jdbc.username", "aggregate")
setPropertiesValue("${classRoot}/jdbc.properties", "jdbc.password", "aggregate")
setPropertiesValue("${classRoot}/jdbc.properties", "jdbc.schema", "aggregate")
setPropertiesValue("${classRoot}/security.properties", "security.server.realm.realmString", "ODK Aggregate")
setPropertiesValue("${classRoot}/security.properties", "security.server.channelType", "ANY_CHANNEL")
setPropertiesValue("${classRoot}/security.properties", "security.server.superUserUsername", "administrator")
setPropertiesValue("${classRoot}/security.properties", "security.server.superUser", "")
setPropertiesValue("${classRoot}/security.properties", "security.server.port", "8080")
setPropertiesValue("${classRoot}/security.properties", "security.server.securePort", "8443")
setPropertiesValue("${classRoot}/security.properties", "security.server.deviceAuthentication", "digest")
setPropertiesValue("${classRoot}/security.properties", "security.server.hostname", "")
setPropertiesValue("${classRoot}/security.properties", "security.server.secureChannelType", "ANY_CHANNEL")
setPropertiesValue("${classRoot}/security.properties", "security.help.about", "auto-generated on 1970-01-01T00:00:00+0000 for ODK Aggregate")
}
}
task dockerBuild(dependsOn: [build, dockerPrepare], type: Exec) {
workingDir "${buildTarget}"
commandLine 'docker', 'build', '-t', "aggregate:${getVersionName()}".toString(), '.'
doLast {
println ""
println "Your Aggregate Docker image is ready to run."
println "Please, refer to https://github.com/opendatakit/aggregate/tree/master/docs/build-and-run-a-docker-image.md for instructions."
}
}