Repository navigation
Expand file tree
/
Copy pathbuild.gradle
More file actions
85 lines (60 loc) · 2.18 KB
/
Copy pathbuild.gradle
File metadata and controls
85 lines (60 loc) · 2.18 KB
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
description = 'ORN demo Java servlet project'
apply plugin: 'war'
import com.bmuschko.gradle.docker.tasks.image.Dockerfile
import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.bmuschko:gradle-tomcat-plugin:2.2.5'
classpath 'io.spring.gradle:dependency-management-plugin:1.0.0.RELEASE'
classpath 'com.bmuschko:gradle-docker-plugin:3.0.7'
}
}
apply plugin: 'com.bmuschko.tomcat'
apply plugin: 'io.spring.dependency-management'
apply plugin: 'com.bmuschko.docker-remote-api'
repositories {
mavenCentral()
}
dependencyManagement {
imports {
mavenBom 'org.arquillian:arquillian-universe:1.1.13.3'
}
}
dependencies {
providedCompile 'javax.servlet:javax.servlet-api:3.1.0'
def tomcatVersion = '8.0.43'
def tomcatDeps = ["org.apache.tomcat.embed:tomcat-embed-core:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-logging-juli:${tomcatVersion}",
"org.apache.tomcat.embed:tomcat-embed-jasper:${tomcatVersion}"]
tomcat tomcatDeps
testCompile tomcatDeps
testCompile 'junit:junit:4.12'
testCompile 'org.arquillian.universe:arquillian-junit'
testCompile 'org.jboss.arquillian.container:arquillian-tomcat-embedded-8:1.0.0'
}
docker {
certPath = null
}
task buildDockerfile(type: Dockerfile, dependsOn: war) {
destFile = project.file('build/Dockerfile')
from "tomcat:8.0-jre8"
maintainer 'Tim Dudgeon <tdudgeon@informaticsmatters.com>'
runCommand("rm -rf /usr/local/tomcat/webapps/*")
def warFile = tasks.war.outputs.files.singleFile
addFile('libs/' + warFile.name, "/usr/local/tomcat/webapps/ROOT.war")
//runCommand('groupadd -r tomcat -g 501')
runCommand('useradd -u 501 -m -g root tomcat')
runCommand('chown -R tomcat:root /usr/local/tomcat')
user('501')
exposePort(8080)
}
// build image is broken due to docker-java issues
// https://github.com/bmuschko/gradle-docker-plugin/issues/364
//task buildDockerImage(type: DockerBuildImage) {
// dependsOn buildDockerfile
// inputDir = buildDockerfile.destFile.parentFile
// tag = "orn/example-java-servlet"
//}