Skip to content

A Spring Boot application that compiles with GraalVM and runs on a raspberry pi (pi0w2!)

License

Notifications You must be signed in to change notification settings

mpalourdio/graalvm-springboot-raspberry

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CI

Introduction

Hey, I am a Raspberry PI (and a GraalVM) enthusiast!

This a sample project to demonstrate how to build a Spring Boot 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 image from a linux/amd64 host.

Steps

  • 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.io/library/graalvm-springboot-raspberry:0.0.1-SNAPSHOT.
  • 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 -it graalvm-springboot-raspberry:0.0.1-SNAPSHOT.

Thanks

Kudos to @dashaun for the inspiration. Check this blog post here.

Image ready to test ?

Just grab this image generated from GitHub actions.

Failed to create the main Isolate. (code 24) ?

Follow these instructions for Raspberry PI 5.

About

A Spring Boot application that compiles with GraalVM and runs on a raspberry pi (pi0w2!)

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published