Skip to content

Commit

Permalink
Merge pull request #1 from mpalourdio/armrunner
Browse files Browse the repository at this point in the history
feat: build on arm64 runners
  • Loading branch information
mpalourdio authored Feb 22, 2025
2 parents 1c0a28b + f6130a5 commit 6ce49ef
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
7 changes: 2 additions & 5 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [ push, pull_request, workflow_dispatch ]

jobs:
build:
runs-on: ubuntu-latest
runs-on: ubuntu-24.04-arm
strategy:
max-parallel: 4
matrix:
Expand All @@ -14,17 +14,14 @@ jobs:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- uses: graalvm/setup-graalvm@v1
with:
distribution: 'graalvm-community'
java-version: ${{ matrix.graalvm-version }}
cache: 'maven'

- name: GraalVM Compile and image generation
run: ./mvnw clean -Pnative spring-boot:build-image -Dspring-boot.build-image.imagePlatform=linux/arm64
run: ./mvnw clean -Pnative spring-boot:build-image

- name: Backup image and move it to tmp folder
run: mkdir imagebackup && docker save -o imagebackup/raspberry.tar docker.io/library/graalvm-springboot-raspberry:0.0.1-SNAPSHOT
Expand Down
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

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.
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` image from a `linux/amd64` host.
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
# 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`.
Expand All @@ -26,7 +26,8 @@ Kudos to [@dashaun](https://github.com/dashaun/) for the inspiration. Check this

# Image ready to test ?

Just grab [this image generated from GitHub actions](https://mpalourdio.github.io/graalvm-springboot-raspberry/raspberry.tar).
Just grab [this image generated from GitHub actions](https://mpalourdio.github.io/graalvm-springboot-raspberry/raspberry.tar).
[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) ?

Expand Down

0 comments on commit 6ce49ef

Please sign in to comment.