annotate build.gradle @ 2:91703efb1d29

update ssdt-forms and dockerize
author smith@nwoca.org
date Mon, 11 Apr 2016 11:53:50 -0400
parents f4f8570d1c56
children
rev   line source
2
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
1 import java.time.Instant
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
2 import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
3 import com.bmuschko.gradle.docker.tasks.image.Dockerfile
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
4
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
5 apply from: "${gradle.ext.has('ssdtDevelkitLocation') ? gradle.ssdtDevelkitLocation : 'http://hg.ssdt-ohio.org/browse/public/develkit'}/init20.gradle"
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
6
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
7 buildscript {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
8 repositories {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
9 maven { url 'http://repos.ssdt.nwoca.org/artifactory/gradle-plugins' }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
10 maven { url 'http://repos.ssdt.nwoca.org/artifactory/repo' }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
11 }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
12 dependencies {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
13 classpath 'com.bmuschko:gradle-docker-plugin:2.6.5'
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
14 }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
15 }
0
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
16
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
17 description = "ssdt.forms application"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
18
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
19 apply plugin: "war"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
20 apply plugin: "java"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
21 apply plugin: "groovy"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
22 apply plugin: "jetty"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
23 apply plugin: "idea"
2
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
24 apply plugin: 'com.bmuschko.docker-remote-api'
0
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
25
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
26 sourceCompatibility = "1.5"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
27 targetCompatibility = "1.5"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
28
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
29 group = "org.ssdt_ohio"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
30 version = "1.0-SNAPSHOT"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
31
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
32 configurations {
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
33 provided
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
34 }
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
35
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
36 sourceSets {
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
37 main {
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
38 compileClasspath += configurations.provided
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
39 }
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
40 test {
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
41 compileClasspath += configurations.provided
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
42 runtimeClasspath += configurations.provided
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
43 }
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
44 }
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
45
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
46 dependencies {
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
47
2
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
48 compile 'org.codehaus.groovy:groovy-all:2.4.5'
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
49 compile "org.apache.tapestry:tapestry-core:5.3.8"
0
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
50 compile(group: 'me.davesmith', name: 'tapestry-bootstrap', version: '2.1-SNAPSHOT')
2
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
51 compile group: 'org.got5', name: 'tapestry5-jquery', version: '3.3.6'
0
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
52 compile "org.apache.tapestry:tapestry-yuicompressor:5.3.6"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
53
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
54 // Uncomment this to add support for file uploads:
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
55 // compile "org.apache.tapestry:tapestry-upload:5.3.6"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
56
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
57 provided "javax.servlet:servlet-api:2.5"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
58 }
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
59
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
60 test {
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
61 useTestNG()
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
62
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
63 options.suites("src/test/conf/testng.xml")
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
64
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
65 systemProperties["tapestry.service-reloading-enabled"] = "false"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
66 systemProperties["tapestry.execution-mode"] = "development"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
67
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
68 maxHeapSize = "600M"
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
69
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
70 jvmArgs("-XX:MaxPermSize=256M")
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
71
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
72 enableAssertions = true
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
73 }
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
74
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
75
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
76 jettyRun {
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
77 webAppSourceDirectory = file("src/main/webapp")
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
78 httpPort = 8086
f4f8570d1c56 initial OTP form
smith@nwoca.org
parents:
diff changeset
79 }
2
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
80
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
81
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
82 docker {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
83 if (System.env.DOCKER_HOST) {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
84 url = "https:${System.env.DOCKER_HOST?.minus('tcp:')}"
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
85 }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
86 if (System.env.DOCKER_CERT_PATH) {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
87 certPath = new File("$System.env.DOCKER_CERT_PATH")
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
88 }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
89 }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
90
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
91
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
92 war {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
93 archiveName 'ssdtforms.war'
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
94 }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
95
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
96 task createDockerfile(type: Dockerfile) {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
97 group = "Docker"
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
98 destFile = project.file('build/docker/Dockerfile')
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
99 from 'docker.ssdt.io/ssdt-tomcat:3'
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
100 maintainer 'Dave Smith <smith@nwoca.org>'
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
101 label {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
102 [
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
103 'io.ssdt.version' : version,
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
104 'io.ssdt.id' : "${project.name}",
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
105 'io.ssdt.type' : "webapp",
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
106 'io.ssdt.app' : "ssdtforms",
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
107 'io.ssdt.build.date' : Instant.now().toString(),
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
108 ]
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
109 }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
110 copyFile("ssdtforms.war", '/usr/local/tomcat/webapps/ROOT.war')
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
111 }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
112
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
113
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
114 task prepareDockerImage(type: Copy) {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
115 group = "Docker"
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
116 dependsOn war
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
117 dependsOn createDockerfile
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
118 from war.getArchivePath()
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
119 into project.file('build/docker')
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
120 }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
121
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
122 task buildDockerImage(type: DockerBuildImage) {
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
123 group = "Docker"
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
124 dependsOn prepareDockerImage
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
125 inputDir = createDockerfile.destFile.parentFile
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
126 tag = "ssdtforms:latest"
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
127 }
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
128
91703efb1d29 update ssdt-forms and dockerize
smith@nwoca.org
parents: 0
diff changeset
129