Logo

dev-resources.site

for different kinds of informations.

A new builder for Spring Boot 3 RC1 on ARM64

Published at
11/14/2022
Categories
springboot
buildpack
arm64
m1
Author
dashaun
Categories
4 categories in total
springboot
open
buildpack
open
arm64
open
m1
open
Author
7 person written this
dashaun
open
A new builder for Spring Boot 3 RC1 on ARM64

Background

I’m a fan of using buildpacks. I’ve been using and updating the paketo-arm64 repository started by Daniel Mikusa. 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. 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. 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 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

Enter fullscreen mode Exit fullscreen mode

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 -

Enter fullscreen mode Exit fullscreen mode

In the pom.xml replace this:

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

Enter fullscreen mode Exit fullscreen mode

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>

Enter fullscreen mode Exit fullscreen mode

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

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

Enter fullscreen mode Exit fullscreen mode

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

Enter fullscreen mode Exit fullscreen mode

Finally

Because I’m done, and moved builder version 7.37.0 to prod, I also cleaned up my terraform deployment.

Another huge “Thanks” to Daniel Mikusa for all of his help.

Links

arm64 Article's
30 articles in total
Favicon
What I learned about the "best price" in retail and how it applies to AI
Favicon
Five Months in the making, multi-architecture builder
Favicon
GKE multi-arch guide
Favicon
Building Multi-Arch Images for Arm and x86
Favicon
Running Redis on Ampere Processors- getting better performance by moving from a legacy architecture
Favicon
Ampere Server Tuning Guides
Favicon
How Vandebron helps balancing the Dutch energy grid together with OnLogic & Talos Linux
Favicon
FOSSY '23 CfP Open
Favicon
Ship It on ARM64! Or Is It AARCH64?
Favicon
Run an Ubuntu VM on Apple Silicon
Favicon
Teamwork makes the dream work for this multi-architecture builder.
Favicon
Cloud Native Buildpack for ARM64 and AMD64
Favicon
A new builder for Spring Boot 3 RC1 on ARM64
Favicon
Deploying ARM64 workloads to AKS
Favicon
Building an arm64 container for Apache Druid for your Apple Silicon
Favicon
How to Read Multiple Barcode and QR Code with Dynamsoft Java Barcode SDK
Favicon
Create docker image on your new MacBook Pro M1 version
Favicon
Install Elm for Linux arm64
Favicon
MongoDB for arm64 at Alibaba Cloud
Favicon
Rodando projetos x86_64 no Mac M1 (arm64) com UTM
Favicon
12th weekly post, empty string is everywhere. Also, AWS Lambda goes Arm.
Favicon
Installing K8 on ARM64 [4 cpu, 24Gb RAM]
Favicon
Install mongodb 4.4 to arm64 amazon Linux 2
Favicon
Converting dev environments to Apple Silicon
Favicon
Running Vagrant on an M1 Apple Silicon using Docker
Favicon
M1 기반 Mac에서 안드로이드 에뮬레이터 사용하기
Favicon
Check which apps on your Mac don't support Arm64
Favicon
Homebrew M1 (ARM64)
Favicon
FusionAuth on Arm64
Favicon
Running OpenFaaS and MongoDB on Raspbian 64bit

Featured ones: