-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbuild.gradle
More file actions
99 lines (81 loc) · 3.77 KB
/
build.gradle
File metadata and controls
99 lines (81 loc) · 3.77 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/*
* This file was generated by the Gradle 'init' task.
*
* This generated file contains a sample Java application project to get you started.
* For more details take a look at the 'Building Java & JVM projects' chapter in the Gradle
* User Manual available at https://docs.gradle.org/7.4.1/userguide/building_java_projects.html
*/
plugins {
// Apply the groovy plugin to also add support for Groovy (needed for Spock)
id 'groovy'
id 'java'
// we enable the application plugin so that we can run things using "./gradlew run ..."
// but the container is build using the docker plugin that follows
id 'application'
// docker plugin
id 'com.bmuschko.docker-java-application' version '7.3.0'
}
import static com.bmuschko.gradle.docker.tasks.image.Dockerfile.*
repositories {
// Use Maven Central for resolving dependencies.
mavenCentral()
}
dependencies {
// These dependencies are used by the application.
implementation 'commons-cli:commons-cli:1.5.0'
def cdkVersion = '2.7.1'
implementation "org.openscience.cdk:cdk-core:$cdkVersion"
implementation "org.openscience.cdk:cdk-data:$cdkVersion"
implementation "org.openscience.cdk:cdk-silent:$cdkVersion"
implementation "org.openscience.cdk:cdk-io:$cdkVersion"
implementation "org.openscience.cdk:cdk-ioformats:$cdkVersion"
implementation "org.openscience.cdk:cdk-smiles:$cdkVersion"
implementation "org.openscience.cdk:cdk-inchi:$cdkVersion"
implementation "org.openscience.cdk:cdk-pdb:$cdkVersion"
implementation "org.openscience.cdk:cdk-qsarmolecular:$cdkVersion"
implementation "org.openscience.cdk:cdk-extra:$cdkVersion"
implementation "org.openscience.cdk:cdk-renderbasic:$cdkVersion"
implementation "org.openscience.cdk:cdk-renderawt:$cdkVersion"
implementation "org.openscience.cdk:cdk-sdg:$cdkVersion"
implementation "org.openscience.cdk:cdk-depict:$cdkVersion"
implementation "org.openscience.cdk:cdk-signature:$cdkVersion"
// Use the latest Groovy version for Spock testing
testImplementation 'org.codehaus.groovy:groovy:3.0.9'
// Use the awesome Spock testing and specification framework even with Java
testImplementation 'org.spockframework:spock-core:2.0-groovy-3.0'
testImplementation 'junit:junit:4.13.2'
// CDK
testImplementation "org.openscience.cdk:cdk-datadebug:$cdkVersion"
}
application {
// Define the main class for the application.
// this can be set as a commandline option e.g.
// ./gradlew run --args="--help" -PmainClass=org.foo.Bar
mainClass = project.hasProperty("mainClass") ? project.getProperty("mainClass") : 'squonk.jobs.cdk.DescriptorsExec'
}
tasks.named('test') {
// Use JUnit Platform for unit tests.
useJUnitPlatform()
}
docker {
javaApplication {
baseImage = 'openjdk:11-jre-slim'
maintainer = 'Tim Dudgeon "tdudgeon@informaticsmatters.com"'
ports = []
images = ['informaticsmatters/squonk2-cdk:latest']
mainClassName = 'squonk.jobs.cdk.DescriptorsExec'
}
}
// This modifies the Dockerfile that is build by the docker-java-application plugin.
// The ENTRYPOINT is replaced with 'java' and the classpath arguments
// A CMD added that is '-version'.
// The expectation is that the CMD will be overridden at runtime.
dockerCreateDockerfile {
List<Instruction> originalInstructions = new ArrayList<Instruction>(instructions.get())
int entrypointIndex = originalInstructions
.findIndexOf { it.keyword == EntryPointInstruction.KEYWORD}
originalInstructions.remove(entrypointIndex)
originalInstructions.add(new DefaultCommandInstruction("java -version"))
originalInstructions.add(new EnvironmentVariableInstruction("CLASSPATH", "/app/resources:/app/classes:/app/libs/*"))
instructions.set(originalInstructions)
}