Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions .github/workflows/github-actions-micronaut-webserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '24'
java-version: '25'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Micronaut Web Server
Expand All @@ -35,14 +35,23 @@ jobs:
container_id=$(docker run --rm -d -p8080:8080 webserver:distroless-java-base.jar)
sleep 10
docker ps
sleep 2
for i in {1..10}; do
if curl -s "http://localhost:8080/" > /dev/null; then
echo "Server is up!"
break
fi
echo "Waiting for server..."
sleep 2
done
curl "http://localhost:8080/"
docker kill $container_id
docker ps
#

# Build JAR (Eclipse-temurin:21)
# Build JAR (Eclipse-temurin:25)
./build-jar-eclipse-temurin.sh
container_id=$(docker run --rm -d -p8081:8080 webserver:eclispe-temurin-jar)
container_id=$(docker run --rm -d -p8081:8080 webserver:eclipse-temurin-jar)
sleep 10
docker ps
curl "http://localhost:8081/"
Expand Down Expand Up @@ -80,15 +89,6 @@ jobs:
docker ps
#

# Build dynamic image, optimized for size with SkipFlow (Distroless Java Base Debian)
./build-dynamic-image-skipflow.sh
container_id=$(docker run --rm -d -p8085:8080 webserver:distroless-java-base.dynamic-skipflow)
sleep 10
docker ps
curl "http://localhost:8085/"
docker kill $container_id
docker ps
#

# Setup musl toolchain
./setup-musl.sh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '24'
java-version: '25'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:

- uses: graalvm/setup-graalvm@v1
with:
java-version: '24'
java-version: '25'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

- uses: graalvm/setup-graalvm@v1
with:
java-version: '24'
java-version: '25'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Test Java Code
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '24'
java-version: '25'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and run
Expand Down
10 changes: 3 additions & 7 deletions .github/workflows/github-actions-spring-boot-webserver.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '24'
java-version: '25'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Run Spring Boot Web Server
Expand All @@ -26,11 +26,11 @@ jobs:
cd /home/runner/work/workshops/workshops/native-image/spring-boot-webserver
#

# Build JAR (Debian Distoless Java 21)
# Build JAR (Debian Distoless Java 25)
./build-jar-java-base.sh
#

# Build JAR (Eclipse-temurin:21)
# Build JAR (Eclipse-temurin:25)
./build-jar-eclipse-temurin.sh
#

Expand All @@ -46,10 +46,6 @@ jobs:
./build-dynamic-image-optimized.sh
#

# Build dynamic image, optimized for size with SkipFlow (Distroless Java Base Debian)
./build-dynamic-image-skipflow.sh
#

# Setup musl toolchain
./setup-musl.sh
export PATH="$PWD/musl-toolchain/bin:$PATH"
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/github-actions-what-the-dickens.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Set up GraalVM
uses: graalvm/setup-graalvm@v1
with:
java-version: '24'
java-version: '25'
distribution: 'graalvm'
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build and Test Java Code
Expand All @@ -30,7 +30,7 @@ jobs:
pid=$!
kill $pid

# Build a regular dynamic native image and containerize in docker.io/oraclelinux:8-slim container
# Build a regular dynamic native image and containerize in docker.io/oraclelinux:9-slim container
docker build -f ./01-native-image/Dockerfile \
-t what_the_dickens:native.01 .
container_id=$(docker run --rm -d --name "what_the_dickens-native" -p 8080:8080 what_the_dickens:native.01)
Expand Down
10 changes: 5 additions & 5 deletions .install/oci-ol8-graalvm-ee-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,12 @@ readonly SETUP_SCRIPT_VERSION="1.0.0"

echo "OCI OL8 GraalVM EE Install Script: VERSION ${SETUP_SCRIPT_VERSION}"

# Check for Oracle Linux 8
if [ "ol8" == `cat /etc/oracle-release | sed -E 's|Oracle Linux Server release 8\..+|ol8|'` ]; then
echo -e "\e[32mSystem is Oracle Linux 8\e[0m"
# Check for Oracle Linux 9
if [ "ol8" == `cat /etc/oracle-release | sed -E 's|Oracle Linux Server release 9\..+|ol9|'` ]; then
echo -e "\e[32mSystem is Oracle Linux 9\e[0m"
else
echo -e "\e[31mSystem is NOT Oracle Linux 8\e[0m"
echo -e "\e[31mThis install script is only meant to run with Oracle Linnux 8\e[0m"
echo -e "\e[31mSystem is NOT Oracle Linux 9\e[0m"
echo -e "\e[31mThis install script is only meant to run with Oracle Linux 9\e[0m"
exit 1
fi

Expand Down
14 changes: 7 additions & 7 deletions native-image/containerisation/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

This workshop takes you step by step through the process of how to compile a Java application ahead of time with GraalVM Native Image and containerize it.

[GraalVM Native Image](https://docs.oracle.com/en/graalvm/jdk/latest/docs/reference-manual/native-image/) compiles Java code ahead of time into a self-contained native executable.
[GraalVM Native Image](https://www.graalvm.org/latest/reference-manual/native-image/) compiles Java code ahead of time into a self-contained native executable.
Only the code that is required by the application at run time is packaged into the executable.
A native executable produced by Native Image has several important advantages, in that it:

Expand Down Expand Up @@ -37,9 +37,9 @@ In this workshop you will:

Before starting this workshop, you must have installed:

* [GraalVM for JDK 24](https://www.graalvm.org/downloads/). We recommend using [SDKMAN!](https://sdkman.io/). (For other download options, see [GraalVM Downloads](https://www.graalvm.org/downloads/).)
* [GraalVM 25](https://www.graalvm.org/downloads/). We recommend using [SDKMAN!](https://sdkman.io/). (For other download options, see [GraalVM Downloads](https://www.graalvm.org/downloads/).)
```bash
sdk install java 24-graal
sdk install java 25-graal
```
* Container runtime such as [Docker](https://www.docker.com/gettingstarted/), or [Rancher Desktop](https://docs.rancherdesktop.io/getting-started/installation/) installed and running.

Expand Down Expand Up @@ -124,13 +124,13 @@ To build the application, you are going to use Maven. The _pom.xml_ file was gen

Containerizing a Java application in a container image is straightforward.
You can build a new Docker image based on one that contains a JDK distribution.
For this workshop, you will use a container with the Oracle Linux 8 and the [NFTC Oracle JDK 21 image](https://container-registry.oracle.com/ords/ocr/ba/java/jdk-no-fee-term): `container-registry.oracle.com/java/jdk-no-fee-term:21-oraclelinux8`.
For this workshop, you will use a container with the Oracle Linux 9 and the [NFTC Oracle JDK 25 image](https://container-registry.oracle.com/ords/ocr/ba/java/jdk-no-fee-term): `container-registry.oracle.com/java/jdk-no-fee-term:25-oraclelinux9`.

The following is a breakdown of the Dockerfile, which describes how to build the Docker image. See the comments to explain the contents.

```dockerfile
# Base Image
FROM container-registry.oracle.com/java/jdk-no-fee-term:21-oraclelinux8
FROM container-registry.oracle.com/java/jdk-no-fee-term:25-oraclelinux9

# Pass in the JAR file as an argument to the image build
ARG JAR_FILE
Expand Down Expand Up @@ -336,7 +336,7 @@ and the second step copies the native executable into a deployment container.
> The first step in the process builds a Linux-compatible executable and the second step packages that into a container image for deployment.

```dockerfile
FROM container-registry.oracle.com/graalvm/native-image:24 AS builder
FROM container-registry.oracle.com/graalvm/native-image:25 AS builder

# Set the working directory
WORKDIR /build
Expand Down Expand Up @@ -458,7 +458,7 @@ Again you are going to use a multi-stage build.
Take a look at the contents of the Dockerfile, which has comments to explain each line:

```dockerfile
FROM container-registry.oracle.com/graalvm/native-image:24 AS builder
FROM container-registry.oracle.com/graalvm/native-image:25 AS builder

# Set the working directory
WORKDIR /build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base Image
FROM container-registry.oracle.com/java/jdk-no-fee-term:21-oraclelinux8
FROM container-registry.oracle.com/java/jdk-no-fee-term:25-oraclelinux9

# Pass in the JAR file as an argument to the image build
ARG JAR_FILE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base Image
FROM container-registry.oracle.com/graalvm/native-image:24 AS builder
FROM container-registry.oracle.com/graalvm/native-image:25 AS builder

# Set the working directory to /home/app
WORKDIR /build
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# The deployment Image
FROM docker.io/oraclelinux:8-slim
FROM container-registry.oracle.com/os/oraclelinux:9-slim

# Pass in the JAR file as an argument to the image build
ARG APP_FILE
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Base Image
FROM container-registry.oracle.com/graalvm/native-image:24 AS builder
FROM container-registry.oracle.com/graalvm/native-image:25 AS builder

# Set the working directory to /home/app
WORKDIR /build
Expand Down
21 changes: 17 additions & 4 deletions native-image/containerisation/lab/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,30 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.4.0</version>
<version>3.5.6</version>
<relativePath/>
</parent>
<groupId>com.example</groupId>
<artifactId>jibber</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>jibber</name>
<description>Demo project for Spring Boot with GraalVM Native Image</description>
<properties>
<java.version>21</java.version>
<native-buildtools.version>0.10.6</native-buildtools.version>
<url/>
<licenses>
<license/>
</licenses>
<developers>
<developer/>
</developers>
<scm>
<connection/>
<developerConnection/>
<tag/>
<url/>
</scm>
<properties>
<java.version>25</java.version>
<native-buildtools.version>0.11.0</native-buildtools.version>
</properties>
<dependencies>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2025 Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
*/

package com.example.demo;

import org.springframework.boot.SpringApplication;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2025 Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
*/

package com.example.demo;

import rita.RiMarkov;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
/*
* Copyright © 2025 Oracle and/or its affiliates.
*
* Licensed under the Universal Permissive License v 1.0 as shown at http://oss.oracle.com/licenses/upl.
*/

package com.example.demo;

import org.junit.jupiter.api.Test;
Expand Down
2 changes: 1 addition & 1 deletion native-image/micronaut-webserver/Dockerfile.alpine.static
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM container-registry.oracle.com/graalvm/native-image:24-muslib AS nativebuild
FROM container-registry.oracle.com/graalvm/native-image:25-muslib AS nativebuild
COPY . /webserver
WORKDIR /webserver
# Build a fully static native image with optimization for size
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM container-registry.oracle.com/graalvm/native-image:24 AS nativebuild
FROM container-registry.oracle.com/graalvm/native-image:25 AS nativebuild
COPY . /webserver
WORKDIR /webserver
# Build a mostly statically linked native image with optimization for size
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM container-registry.oracle.com/graalvm/jdk:24 AS build
FROM container-registry.oracle.com/graalvm/jdk:25 AS build
COPY . /webserver
WORKDIR /webserver
RUN ./mvnw --no-transfer-progress clean package
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM container-registry.oracle.com/graalvm/native-image:24 AS nativebuild
FROM container-registry.oracle.com/graalvm/native-image:25 AS nativebuild
COPY . /webserver
WORKDIR /webserver
# Build a dynamically linked native image with default configuration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM container-registry.oracle.com/graalvm/native-image:24 AS nativebuild
FROM container-registry.oracle.com/graalvm/native-image:25 AS nativebuild
COPY . /webserver
WORKDIR /webserver
# Build a dynamically linked native image with optimization for size
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM container-registry.oracle.com/graalvm/jdk:24 AS build
FROM container-registry.oracle.com/graalvm/jdk:25 AS build
COPY . /webserver
WORKDIR /webserver
RUN ./mvnw --no-transfer-progress clean package
RUN ./mvnw dependency:build-classpath -Dmdep.outputFile=cp.txt
RUN CP=$(cat cp.txt) && \
MODULES=$(jdeps --ignore-missing-deps -q --recursive --multi-release 24 --print-module-deps --class-path "$CP" target/webserver-0.1.jar) && \
MODULES=$(jdeps --ignore-missing-deps -q --recursive --multi-release 25 --print-module-deps --class-path "$CP" target/webserver-0.1.jar) && \
echo "Modules: $MODULES" && \
jlink \
--module-path "${JAVA_HOME}/jmods" \
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
FROM container-registry.oracle.com/graalvm/jdk:24 AS build
FROM container-registry.oracle.com/graalvm/jdk:25 AS build
COPY . /webserver
WORKDIR /webserver
RUN ./mvnw --no-transfer-progress clean package

# Distoless Java 21 (Debian)
FROM eclipse-temurin:21
# Eclipse Temurin Java 25
FROM eclipse-temurin:25
COPY --from=build /webserver/target/webserver-0.1.jar webserver-0.1.jar
EXPOSE 8080
ENTRYPOINT ["java", "-jar", "webserver-0.1.jar"]
2 changes: 1 addition & 1 deletion native-image/micronaut-webserver/Dockerfile.scratch.static
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM container-registry.oracle.com/graalvm/native-image:24-muslib AS nativebuild
FROM container-registry.oracle.com/graalvm/native-image:25-muslib AS nativebuild
COPY . /webserver
WORKDIR /webserver
# Build a fully static native image with optimization for size
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM container-registry.oracle.com/graalvm/native-image:24-muslib AS nativebuild
FROM container-registry.oracle.com/graalvm/native-image:25-muslib AS nativebuild
COPY . /webserver
WORKDIR /webserver

Expand Down
Loading