Test if static resources are present #28
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "From JIT to Native: Efficient Java Containers with GraalVM and Micronaut" | |
on: | |
push: | |
paths: | |
- 'native-image/micronaut-webserver/**' | |
- '.github/workflows/github-actions-micronaut-webserver.yml' | |
jobs: | |
build: | |
name: Run Micronaut webserver | |
runs-on: ubuntu-latest | |
timeout-minutes: 40 | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up GraalVM | |
uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '24' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run Micronaut Web Server | |
# working-directory: native-image/micronaut-webserver | |
run: | | |
# Prepare static resources | |
pwd | |
cd /home/runner/work/workshops/workshops/native-image/micronaut-webserver | |
unzip src/main/resources/static.zip -d src/main/resources | |
ls | |
ls src/main/resources | |
# | |
# Build JAR (Debian Distoless Java 21) | |
./build-jar-java-base.sh | |
container_id=$(docker run --rm -d -p8080:8080 webserver:distroless-java-base.jar) | |
sleep 10 | |
docker ps | |
curl "http://localhost:8080/" | |
docker kill $container_id | |
docker ps | |
# | |
# Build JAR (Eclipse-temurin:21) | |
./build-jar-eclipse-temurin.sh | |
container_id=$(docker run --rm -d -p8081:8080 webserver:eclispe-temurin-jar) | |
sleep 10 | |
docker ps | |
curl "http://localhost:8081/" | |
docker kill $container_id | |
docker ps | |
# | |
# Build Jlink custom runtime (Distroless Java Base Debian) | |
./build-jlink.sh | |
container_id=$(docker run --rm -d -p8082:8080 webserver:distroless-java-base.jlink) | |
sleep 10 | |
docker ps | |
curl "http://localhost:8082/" | |
docker kill $container_id | |
docker ps | |
# | |
# Build dynamic image (Distroless Java Base Debian) | |
./build-dynamic-image.sh | |
container_id=$(docker run --rm -d -p8083:8080 webserver:distroless-java-base.dynamic) | |
sleep 10 | |
docker ps | |
curl "http://localhost:8083/" | |
docker kill $container_id | |
docker ps | |
# | |
# Build dynamic image, optimized for size (Distroless Java Base Debian) | |
./build-dynamic-image-optimized.sh | |
container_id=$(docker run --rm -d -p8084:8080 webserver:distroless-java-base.dynamic-optimized) | |
sleep 10 | |
docker ps | |
curl "http://localhost:8084/" | |
docker kill $container_id | |
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 | |
export PATH="$PWD/musl-toolchain/bin:$PATH" | |
# | |
# Build mostly static image (Distroless Base Debian) | |
./build-mostly-static-image.sh | |
container_id=$(docker run --rm -d -p8086:8080 webserver:distroless-base.mostly-static) | |
sleep 10 | |
docker ps | |
curl "http://localhost:8086/" | |
docker kill $container_id | |
docker ps | |
# | |
# Build fully static image (Scratch) | |
./build-static-image.sh | |
container_id=$(docker run --rm -d -p8087:8080 webserver:scratch.static) | |
sleep 10 | |
docker ps | |
curl "http://localhost:8087/" | |
docker kill $container_id | |
docker ps | |
# | |
# Download upx | |
./setup-upx.sh | |
# | |
# Build fully static compressed image (Scratch UPX) | |
./build-static-upx-image.sh | |
container_id=$(docker run --rm -d -p8088:8080 webserver:scratch.static-upx) | |
sleep 10 | |
docker ps | |
curl "http://localhost:8088/" | |
docker kill $container_id | |
docker ps | |
# | |
docker images webserver |