From d4bc34e683dcec788c25b127fcef34912caca22f Mon Sep 17 00:00:00 2001 From: Alexander Rovner <124143655+arov00@users.noreply.github.com> Date: Tue, 1 Apr 2025 14:43:40 +0200 Subject: [PATCH 1/2] experimental native image support --- .github/workflows/build-test.yaml | 45 ++++++++++++++++++++++++++++++- 1 file changed, 44 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 42bc0e0..50fa259 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -50,4 +50,47 @@ jobs: VERSION=${{ github.ref_name }} echo IMAGE_ID=$IMAGE_ID echo VERSION=$VERSION - docker push $IMAGE_ID:$VERSION \ No newline at end of file + docker push $IMAGE_ID:$VERSION + build-native: + runs-on: ubuntu-latest + # Configure your build (see README for more information) + env: + APP_NAME: kafka-synth-client + permissions: + contents: write + packages: write + + steps: + - uses: actions/checkout@v3 + - name: Set up JDK 21 + uses: actions/setup-java@v3 + with: + java-version: '21' + distribution: 'graalvm' + cache: maven + - name: Run Unit Tests + run: mvn clean test + - name: Build Container Image + run: | + IMAGE_NAME=${{ github.repository_owner }}/$APP_NAME + IMAGE_ID=ghcr.io/$IMAGE_NAME + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + VERSION="${{ github.ref_name }}-native" + + mvn package -DskipTests + docker build -t $IMAGE_ID:$VERSION . -f src/main/docker/Dockerfile.jvm + - name: Push Image + run: | + # Log in to registry + echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin + docker images + + IMAGE_NAME=${{ github.repository_owner }}/$APP_NAME + IMAGE_ID=ghcr.io/$IMAGE_NAME + + # Change all uppercase to lowercase + IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') + VERSION="${{ github.ref_name }}-native" + echo IMAGE_ID=$IMAGE_ID + echo VERSION=$VERSION + docker push $IMAGE_ID:$VERSION From 8f207138322c54fa16c38f777ba22e77818461cd Mon Sep 17 00:00:00 2001 From: Alexander Rovner <124143655+arov00@users.noreply.github.com> Date: Tue, 1 Apr 2025 14:45:03 +0200 Subject: [PATCH 2/2] build native image --- .github/workflows/build-test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index 50fa259..c82f06f 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -77,8 +77,8 @@ jobs: IMAGE_ID=$(echo $IMAGE_ID | tr '[A-Z]' '[a-z]') VERSION="${{ github.ref_name }}-native" - mvn package -DskipTests - docker build -t $IMAGE_ID:$VERSION . -f src/main/docker/Dockerfile.jvm + mvn package -DskipTests -Dnative -Dquarkus.native.container-build=true + docker build -t $IMAGE_ID:$VERSION . -f src/main/docker/Dockerfile.native - name: Push Image run: | # Log in to registry