-import com.bmuschko.gradle.docker.tasks.image.DockerBuildImage
-
plugins {
id 'java'
id 'org.springframework.boot' version '4.0.2'
id 'io.spring.dependency-management' version '1.1.7'
- id 'com.bmuschko.docker-remote-api' version '9.3.3'
+ id 'com.gorylenko.gradle-git-properties' version '2.4.2'
+ id 'com.google.cloud.tools.jib' version '3.4.5'
}
group = 'de.juplo.kafka'
annotationProcessor 'org.projectlombok:lombok'
}
-docker {
- // Optional: Konfiguriere den Docker-Host, falls nötig
- // url = 'unix:///var/run/docker.sock' (Standard)
-}
-
-
-def targetDir = file("${projectDir}/target")
-def appJarName = "${project.name}-${project.version}.jar"
-
-// Task zum Bereinigen des `target`-Verzeichnisses bei `clean`
-clean {
- delete targetDir
-}
-
-// Task zum Kopieren des Haupt-JARs
-task copyJar(type: Copy) {
- from "$buildDir/libs/${appJarName}"
- into targetDir
- dependsOn build
-
- doFirst {
- def libs = file("${targetDir}/libs")
- mkdir(libs)
- }
+tasks.named('test') {
+ useJUnitPlatform()
}
-// Docker-Task
-task buildDockerImage(type: DockerBuildImage) {
- inputDir = file('.')
- images = ["juplo/${project.name}:${project.version}"]
- dependsOn copyJar
+jib {
+ from { image = 'eclipse-temurin:21-jre' }
+ to { image = "juplo/${project.name}:${project.version}" }
}
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
<plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.45.0</version>
+ <groupId>com.google.cloud.tools</groupId>
+ <artifactId>jib-maven-plugin</artifactId>
+ <version>3.4.5</version>
<configuration>
- <images>
- <image>
- <name>juplo/%a:%v</name>
- </image>
- </images>
+ <from>
+ <image>eclipse-temurin:21-jre</image>
+ </from>
+ <to>
+ <image>juplo/${project.artifactId}:${project.version}</image>
+ </to>
</configuration>
<executions>
<execution>
- <id>build</id>
- <phase>package</phase>
- <goals>
- <goal>build</goal>
- </goals>
+ <phase>package</phase>
+ <goals>
+ <goal>dockerBuild</goal>
+ </goals>
</execution>
</executions>
</plugin>