https://github.com/mpalourdio/graalvm-springboot-raspberry
:hibiscus: A Spring Boot application that compiles with GraalVM and runs on a Raspberry Pi
https://github.com/mpalourdio/graalvm-springboot-raspberry
arm64 docker graalvm java kotlin native-image raspberry-pi spring-boot
Last synced: 9 days ago
JSON representation
:hibiscus: A Spring Boot application that compiles with GraalVM and runs on a Raspberry Pi
- Host: GitHub
- URL: https://github.com/mpalourdio/graalvm-springboot-raspberry
- Owner: mpalourdio
- License: mit
- Created: 2024-12-23T07:02:16.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-05-22T12:30:42.000Z (8 months ago)
- Last Synced: 2025-05-22T14:22:34.543Z (8 months ago)
- Topics: arm64, docker, graalvm, java, kotlin, native-image, raspberry-pi, spring-boot
- Language: Kotlin
- Homepage:
- Size: 35.2 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
[](https://github.com/mpalourdio/graalvm-springboot-raspberry/actions/workflows/main.yml)
# Introduction
Hey, I am a Raspberry PI (and a GraalVM) enthusiast!
This a sample project to demonstrate how to build a Spring Boot / GraalVM Docker image for `arm64` architecture.
It produces a `linux/arm64` ready docker image, and can be run on a Raspberry Pi for example. In my case, it even runs on a `Raspberry Pi Zero 2 W`, which is insane.
GraalVM needs at least `512 MB` to run, what is not possible on the `Raspberry Pi Zero 2 W`. So I had to produce a `linux/arm64` from `GitHub actions`.
# Steps for building a `linux/arm64` docker image from a `linux/amd64` host
- Install QEMU : `docker run --privileged --rm tonistiigi/binfmt --install all` / `docker run --rm --privileged multiarch/qemu-user-static --reset -p yes`.
- Validate that it works: `docker run --platform=linux/arm64 --rm -t arm64v8/ubuntu uname -m`. It should return `aarch64`.
- Build the image for `arm64` architecture : `mvn clean -Pnative spring-boot:build-image -Dspring-boot.build-image.imagePlatform=linux/arm64`.
- Drink some coffee, learn haskell, build linux from scratch, or just wait for the build to finish. It will take some time.
- Save the image : `docker save -o /tmp/raspberry.tar docker pull ghcr.io/mpalourdio/graalvm-springboot-raspberry:latest`.
- Move the image to the target host : `scp /tmp/raspberry.tar pi@192.168.X.X:wherever/`.
- On the target host : `docker load -i wherever/raspberry.tar`.
- Run the image : `docker run -p 8080:8080 --hostname=${HOSTNAME} -it ghcr.io/mpalourdio/graalvm-springboot-raspberry:latest`.
# Thanks
Kudos to [@dashaun](https://github.com/dashaun/) for the inspiration. Check this blog post [here](https://dashaun.com/posts/multi-architecture-spring-oci-from-anywhere-with-paketo/).
# Image ready to test ?
`docker pull ghcr.io/mpalourdio/graalvm-springboot-raspberry:latest`.
[Starting January 2025, GitHub actions provide arm64 runners](https://github.com/orgs/community/discussions/19197#discussioncomment-11859757). This drastically improves build time.
# Failed to create the main Isolate. (code 24) ?
Follow [these instructions](https://pimylifeup.com/raspberry-pi-page-size/) for Raspberry PI 5.