generated from 2martens/template-service
86 lines
2.9 KiB
Groovy
86 lines
2.9 KiB
Groovy
plugins {
|
|
id 'com.google.cloud.tools.jib' version '1.8.0' // jib build our docker images
|
|
id 'org.springframework.boot' version '2.2.4.RELEASE'
|
|
id 'io.spring.dependency-management' version '1.0.9.RELEASE'
|
|
}
|
|
|
|
configurations {
|
|
all {
|
|
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-logging'
|
|
}
|
|
integrationTestImplementation.extendsFrom testImplementation
|
|
}
|
|
|
|
sourceSets {
|
|
integrationTest {
|
|
java {
|
|
compileClasspath += main.output + test.output
|
|
runtimeClasspath += main.output + test.output
|
|
srcDir file('src/integration-test/java')
|
|
}
|
|
resources.srcDir file('src/integration-test/resources')
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
|
implementation 'org.springframework.boot:spring-boot-starter-websocket'
|
|
implementation 'org.springframework.boot:spring-boot-starter-log4j2'
|
|
implementation 'io.micrometer:micrometer-registry-prometheus'
|
|
implementation 'org.springdoc:springdoc-openapi-ui:1.3.9'
|
|
|
|
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
|
|
developmentOnly 'org.springframework.boot:spring-boot-devtools'
|
|
testImplementation('org.springframework.boot:spring-boot-starter-test') {
|
|
// no support for junit 4 Tests
|
|
exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
|
|
// exclude hamcrest, we use asAbbringerFahrtLoeschenTypesertj in unit tests
|
|
exclude group: 'org.hamcrest', module: 'hamcrestv'
|
|
}
|
|
testImplementation 'org.testcontainers:testcontainers:1.12.5'
|
|
// add hamcrest only for mockMvcTest
|
|
// see https://github.com/spring-projects/spring-framework/issues/21178
|
|
testImplementation 'org.hamcrest:hamcrest:2.2'
|
|
}
|
|
|
|
bootJar {
|
|
manifest {
|
|
attributes 'Implementation-Title': archiveBaseName.get(),
|
|
'Implementation-Version': archiveVersion.get(),
|
|
'Implementation-Vendor': "Jim Martens"
|
|
}
|
|
}
|
|
|
|
task integrationTest(type: Test) {
|
|
useJUnitPlatform()
|
|
maxHeapSize = "4g"
|
|
group = 'verification'
|
|
workingDir = rootProject.projectDir
|
|
testClassesDirs = sourceSets.integrationTest.output.classesDirs
|
|
classpath = sourceSets.integrationTest.runtimeClasspath
|
|
}
|
|
|
|
tasks.jib.dependsOn(build)
|
|
tasks.jibDockerBuild.dependsOn(build)
|
|
|
|
jib {
|
|
from {
|
|
image = 'amazoncorretto:11'
|
|
}
|
|
to {
|
|
image = '2martens/oparl'
|
|
tags = ['latest', getProperty('version').toString().replace('+', '-')]
|
|
}
|
|
container {
|
|
jvmFlags = ['-Xms1g', '-Xmx1g', '-Dlog4j.configurationFile=log4j2-docker.xml']
|
|
mainClass = "org.springframework.boot.loader.JarLauncher"
|
|
// 8080 spring boot web, 8081 actuators (prometheus, healthchecks, ...), 9090 grpc
|
|
ports = ['8080', '8081', '9090']
|
|
}
|
|
containerizingMode = 'packaged'
|
|
}
|
|
|
|
tasks.build.dependsOn(integrationTest)
|
|
tasks.integrationTest.mustRunAfter(test)
|
|
|