+++ /dev/null
-FROM eclipse-temurin:21-jre
-VOLUME /tmp
-COPY target/*.jar /opt/app.jar
-ENTRYPOINT [ "java", "-jar", "/opt/app.jar" ]
-CMD []
-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.gorylenko.gradle-git-properties' version '2.4.2'
- id 'com.bmuschko.docker-remote-api' version '9.3.3'
}
group = 'de.juplo.kafka'
buildInfo()
}
-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)
- }
-}
-
-// Docker-Task
-task buildDockerImage(type: DockerBuildImage) {
- inputDir = file('.')
- images = ["juplo/${project.name}:${project.version}"]
- dependsOn copyJar
+bootBuildImage {
+ imageName = "juplo/${project.name}:${project.version}"
}
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
+ <configuration>
+ <image>
+ <name>juplo/${project.artifactId}:${project.version}</name>
+ </image>
+ </configuration>
<executions>
<execution>
<goals>
<groupId>pl.project13.maven</groupId>
<artifactId>git-commit-id-plugin</artifactId>
</plugin>
- <plugin>
- <groupId>io.fabric8</groupId>
- <artifactId>docker-maven-plugin</artifactId>
- <version>0.45.0</version>
- <configuration>
- <images>
- <image>
- <name>juplo/%a:%v</name>
- </image>
- </images>
- </configuration>
- <executions>
- <execution>
- <id>build</id>
- <phase>package</phase>
- <goals>
- <goal>build</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
</plugins>
</build>