A new builder for Spring Boot 3 RC1 on ARM64
Tags: springboot, buildpack, arm64, m1
Published: 2022-11-14 20:02:58

---
title: A new builder for Spring Boot 3 RC1 on ARM64
published: true
date: 2022-11-10 11:18:05 UTC
tags: ["springboot","buildpack","ARM64","M1"]
canonical_url: https://dashaun.com/posts/paketo-aarch64-builder-spring-boot-3-rc1/
cover_image: https://dashaun.com/posts/paketo-aarch64-builder-spring-boot-3-rc1/images/devto.png
series: java native builder multiarch
---

## Background 

I’m a fan of using buildpacks. I’ve been [using](https://dashaun.com/posts/springboot-arm64-image/) and updating the [paketo-arm64 repository started by Daniel Mikusa](https://github.com/dmikusa/paketo-arm64). With Spring Boot 3 going GA, very soon, more people are wanting to use buildpacks with their M1 machines. I feel pressure, in a great way, to get a new version released that includes the latest version of GraalVM.

Because I’m not doing this regularly, I forget the steps that I take to create a new build. So this post, is really a reminder-to-self, but hopefully it helps someone else also.

You can follow along with this on `M1`,`Raspberry Pi`, or a free-tier `ARM64` instance from Oracle.

## Prerequisite 

I’ve been setting up a temporary ARM64 machine on Oracle Cloud for ARM64/aarch64 builds. The repository I use is [here](https://github.com/dashaun/oci-arm64-gha-runner-terraform). I should probably talk about that in another post, also.

My first step was to deploy that machine, so it can be used to build the builder! Once I got the machine up and connected to my repository, I was ready to update the code.

## Make changes 

First I just made changes to the versions in [my GitHub workflow](https://raw.githubusercontent.com/dashaun/paketo-arm64/main/.github/workflows/paketo-arm64.yml). That worked and pushed out a new image, but it wasn’t enough.

I had to re-read the workflow to understand what I was missing.

For each of the files in the `arm64-toml` of [the repository](https://github.com/dashaun/paketo-arm64) I needed to update to the latest versions. This is a tedious, and currently manual, process that requires copy, paste, merge and then creating sha256 values.

For these versions, it was extra messy, because naming conventions changed since my last release. In some places `arm64` was replaced with `aarch64` as one example.

Additionally, some dependencies had even more releases, and I decided to go with the `full` option when it was available.

The last real time-suck was the `sha` values. In the GitHub releases, the sha values are provided as `sha1sum` values. In the builder metadata, it requires `sha256` values. Since I couldn’t find `sha256` values published anywhere, I had to download the dependencies and calculate the values manually. For each dependency update, `curl` then `shasum`, which can be error prone.

```
curl -L https://github.com/bell-sw/Liberica/releases/download/8u352+8/bellsoft-jdk8u352+8-linux-aarch64.tar.gz -O
shasum -a 256 bellsoft-jdk8u352+8-linux-aarch64.tar.gz

```

Hopefully, this post and the small updates I made to the `README.md` will remind me next time. I should probably figure out a way to automate some of that. Maybe a CLI?

## Create an application image 

Create a Spring Boot 3 application with `web` and `actuator` which is enough for a simple test.

```
# Create a Spring Boot 3 application
curl https://start.spring.io/starter.tgz -d dependencies=web,actuator -d javaVersion=17 -d bootVersion=3.0.0-SNAPSHOT -d type=maven-project | tar -xzf -

```

In the pom.xml replace this:

```
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

```

with this:

```
<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
            <configuration>
                <image>
                    <builder>dashaun/java-native-builder-arm64:7.37.0</builder>
                </image>
            </configuration>
        </plugin>
    </plugins>
</build>

```

Build an image using the image builder that we have created and configured.

```
./mvnw -Pnative spring-boot:build-image

```

## Run and test the image 

Run the OCI image with `docker` to start up the server. It should start quickly!

```
# Forward the part, run in the background, but see the startup time
docker run -p 8080:8080 demo:0.0.1-SNAPSHOT &
# Check the endpoint to validate
http http :8080/actuator/health

```

## Finally 

Because I’m done, and moved [builder version 7.37.0 to prod](https://hub.docker.com/r/dashaun/java-native-builder-arm64), I also cleaned up my `terraform` deployment.

Another huge “Thanks” to [Daniel Mikusa](https://twitter.com/dmikusa) for all of his help.

## Links 

- [dashaun/java-native-builder-arm64](https://hub.docker.com/r/dashaun/java-native-builder-arm64)
- [dashaun/paketo-arm64](https://github.com/dashaun/paketo-arm64)
- [dashaun/oci-arm64-gha-runner-terraform](https://github.com/dashaun/oci-arm64-gha-runner-terraform)
- [Related Post](https://dashaun.com/posts/springboot-arm64-image/)