forked from GoogleContainerTools/jib
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
58 lines (49 loc) · 1.65 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
plugins {
id 'java'
id 'com.google.cloud.tools.jib' version '3.1.4'
id 'de.undercouch.download' version '4.0.0'
id "com.gorylenko.gradle-git-properties" version "2.2.0"
}
ext {
// where to download the Stackdriver Debugger agent https://cloud.google.com/debugger/docs/setup/java
stackdriverDebuggerAgentUrl = 'https://storage.googleapis.com/cloud-debugger/compute-java/debian-wheezy/cdbg_java_agent_gce.tar.gz'
// where to place the Cloud Debugger agent in the container
stackdriverDebuggerLocation = '/opt/cdbg'
// location for jib extras, including the Java agent
jibExtraDirectory = "${buildDir}/jib-agents"
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
repositories {
mavenCentral()
}
dependencies {
compile "com.sparkjava:spark-core:2.9.1"
compile "org.slf4j:slf4j-simple:1.7.28"
}
// Download and extract the Cloud Debugger Java Agent
task downloadAgent(type: Download) {
src stackdriverDebuggerAgentUrl
dest "${buildDir}/cdbg_java_agent_gce.tar.gz"
}
task extractAgent(dependsOn: downloadAgent, type: Copy) {
from tarTree(downloadAgent.dest)
into "${jibExtraDirectory}/${stackdriverDebuggerLocation}"
}
jib {
to {
image = 'gcr.io/REPLACE-WITH-YOUR-GCP-PROJECT/image-built-with-jib'
}
extraDirectories.paths = [file(jibExtraDirectory)]
container {
ports = ['4567']
jvmFlags = [
'-agentpath:' + stackdriverDebuggerLocation + '/cdbg_java_agent.so=--logtostderr=1',
'-Dcom.google.cdbg.module=' + project.name,
'-Dcom.google.cdbg.version=' + version]
}
}
tasks.jib.dependsOn extractAgent
tasks.jibDockerBuild.dependsOn extractAgent
tasks.jibBuildTar.dependsOn extractAgent
defaultTasks 'jib'