9 Ağustos 2023 Çarşamba

SpringNative Buildpacks

Giriş
Açıklaması şöyle
Spring Boot includes buildpack support for native images directly for Maven . This means we can just type a single command and quickly get a sensible image into our locally running Docker daemon. The resulting image doesn’t contain a JVM, instead the native image is compiled statically. This leads to smaller images. There are 3 types of buildpack image available for use:
1. paketobuildpacks/builder:tiny
2. paketobuildpacks/builder:base
3. paketobuildpacks/builder:full
spring-boot-starter-parent Kullanıyorsak
Açıklaması şöyle
The spring-boot-starter-parent declares a native profile that configures the executions that need to run in order to create a native image. GraalVM Native Support dependency generate this in pom. You can activate profiles using the -P flag on the command line. 
Şöyle yaparız
<parent>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-parent</artifactId>
  <version>3.1.0</version>
  <relativePath/> <!-- lookup parent from repository -->
 </parent>
Sonra şöyle yaparız
$ mvn -Pnative spring-boot:build-image
Yapılandırılan Docker image'i çalıştırmak için şöyle yaparız
docker run --rm -p 8080:8080 native:0.0.1-SNAPSHOT
spring-boot-starter-parent Kullanmıyorsak
Açıklaması şöyle
If you don’t want to use spring-boot-starter-parent you’ll need to configure executions for the process-aot goal from Spring Boot’s plugin and the add-reachability-metadata goal from the Native Build Tools plugin.
NoClassDefFoundError Hataları
Bu durumda reflection-config.json dosyasını tekrar üretmek gerekir



Hiç yorum yok:

Yorum Gönder