Sign inSign up

deepaksorthiya/spring-boot-graalvm-native

By deepaksorthiya

•Updated about 1 year ago

Spring Boot GraalVM Native Image

Image
Languages & frameworks
0

3.5K

deepaksorthiya/spring-boot-graalvm-native repository overview

Java Maven Build Test
Docker Pulls


⁠** Spring Boot GraalVM Native Image **

⁠Getting Started

⁠Requirements:

Git: 2.49.0
Spring Boot: 3.5.0
Maven: 3.9+
Java GraalVM: 24
Docker Desktop: Tested on 4.42.0

⁠Install GraalVM JDK 24

Install GraalVM JDK 24⁠
Set GRAALVM_HOME as environment path.

⁠Clone this repository:

git clone https://github.com/deepaksorthiya/spring-boot-graalvm-native.git
cd spring-boot-graalvm-native

⁠Build Project Using Native Profile:

./mvnw -Pnative native:compile

It will generate a spring-boot-graalvm-native in target folder.

⁠Run Project:

./target/spring-boot-graalvm-native

⁠Build Docker Image(docker should be running):

Check pom.xml⁠ for native container image config


<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <configuration>
        <image>
            <name>deepaksorthiya/${project.artifactId}:latest</name>
            <publish>false</publish>
            <createdDate>${maven.build.timestamp}</createdDate>
            <builder>bellsoft/buildpacks.builder:musl</builder>
            <env>
                <BP_NATIVE_IMAGE>true</BP_NATIVE_IMAGE>
                <BP_JVM_VERSION>24</BP_JVM_VERSION>
            </env>
        </image>
        <layers>
            <enabled>true</enabled>
        </layers>
    </configuration>
</plugin>
./mvnw clean -Pnative spring-boot:build-image -DskipTests
docker build --progress=plain -f Dockerfile.native -t deepaksorthiya/spring-boot-graalvm-native .

⁠Running On Docker

docker run -p 8080:8080 --name spring-boot-graalvm-native deepaksorthiya/spring-boot-graalvm-native

⁠Testing

./mvnw -PnativeTest test

http://localhost:8080⁠

http://localhost:8080/h2-console⁠

⁠Reference Documentation

For further reference, please consider the following sections:

⁠Guides

The following guides illustrate how to use some features concretely:

Tag summary

Content type

Image

Digest

sha256:bf950f5a0…

Size

48.2 MB

Last updated

about 1 year ago

docker pull deepaksorthiya/spring-boot-graalvm-native