From 8233c76655c878a2fd78d537ebbd58f873fa70bd Mon Sep 17 00:00:00 2001 From: Cheng Jinbao Date: Fri, 26 Jan 2024 17:48:23 +0800 Subject: [PATCH] fix: Shared objects to be dynamically loaded at runtime as needed --- .dockerignore | 3 ++- .github/workflows/so.yml | 32 +++++++++++++++++++++++++++++++ src/main/docker/Dockerfile.native | 4 +++- 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/so.yml diff --git a/.dockerignore b/.dockerignore index 94810d0..afd572b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,6 @@ * !target/*-runner !target/*-runner.jar +!target/*.so !target/lib/* -!target/quarkus-app/* \ No newline at end of file +!target/quarkus-app/* diff --git a/.github/workflows/so.yml b/.github/workflows/so.yml new file mode 100644 index 0000000..562f43c --- /dev/null +++ b/.github/workflows/so.yml @@ -0,0 +1,32 @@ +# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time +# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-maven + +name: Maven CI + +on: + push: + branches: [ so ] + +jobs: + build-image: + name: Build the docker image + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 21 + uses: actions/setup-java@v2 + with: + java-version: '21' + distribution: 'temurin' + cache: maven + - name: Build Image with Maven + run: | + ./mvnw -B -U clean package -Pnative -Dquarkus.container-image.build=true -Dquarkus.container-image.image=cjbi/quarkus-poi-test + docker run cjbi/quarkus-poi-test + - name: Caching Maven Dependencies + uses: actions/cache@v2 + with: + path: ~/.m2/repository + key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }} + restore-keys: | + ${{ runner.os }}-maven- diff --git a/src/main/docker/Dockerfile.native b/src/main/docker/Dockerfile.native index 0d2bf47..dd61dd9 100644 --- a/src/main/docker/Dockerfile.native +++ b/src/main/docker/Dockerfile.native @@ -21,7 +21,9 @@ RUN microdnf update && microdnf install freetype fontconfig && microdnf clean al WORKDIR /work/ RUN chown 1001 /work \ && chmod "g+rwX" /work \ - && chown 1001:root /work + && chown 1001:root /work \ +# Shared objects to be dynamically loaded at runtime as needed +COPY --chown=1001:root target/*.so /work/ COPY --chown=1001:root target/*-runner /work/application EXPOSE 8080