diff --git a/.gitattributes b/.gitattributes index 4fa27a3..f62b15b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,3 +5,9 @@ *.bat text eol=crlf * text eol=lf +*.html text diff=html +*.java text diff=java +*.css text diff=css + +*.jar binary +*.png binary \ No newline at end of file diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 778483a..4982619 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -15,24 +15,16 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - name: Setup Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 - name: Run Gradle 'build' Task run: ./gradlew build - - #- name: Copy OpenAPI Specification - # run: ./gradlew copyOpenApiSpec - - #- name: Build Svelte App - # uses: docker/build-push-action@v4 - #with: - #context: web \ No newline at end of file diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 9ecb5f4..226d66e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -1,25 +1,25 @@ -name: Publish Docker image +name: Publish Artifacts on: release: types: [ released, prereleased ] jobs: - push_to_registry: - name: Push Docker images to Docker Hub + publish_artifacts: + name: Publish Artifacts runs-on: ubuntu-latest steps: - name: Check out - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Set up JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: 'temurin' java-version: '21' - name: Setup Gradle - uses: gradle/gradle-build-action@v2 + uses: gradle/actions/setup-gradle@v3 - name: Log in to Docker Hub uses: docker/login-action@v3 @@ -27,8 +27,13 @@ jobs: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Build and Push Backend Image - run: ./gradlew build -Dquarkus.native.compression.level=9 -Dquarkus.container-image.push=true + - name: Build and Push Native Image + env: + QUARKUS_CONTAINER_IMAGE_BUILD: true + QUARKUS_CONTAINER_IMAGE_PUSH: true + QUARKUS_PACKAGE_TYPE: native + QUARKUS_NATIVE_COMPRESSION_LEVEL: 9 + run: ./gradlew build - name: Copy Linux Binary to Temporary Folder run: cp app/build/tsa-*-runner $RUNNER_TEMP/tsa-linux-amd64 @@ -43,6 +48,14 @@ jobs: asset_name: tsa-linux-amd64 asset_content_type: application/octet-stream + - name: Build and Push JVM Images + env: + QUARKUS_CONTAINER_IMAGE_BUILD: true + QUARKUS_CONTAINER_IMAGE_PUSH: true + QUARKUS_PACKAGE_TYPE: jar + QUARKUS_DOCKER_BUILDX_PLATFORM: linux/amd64,linux/arm64 + run: ./gradlew clean assemble -PimageTagSuffix=jvm + - name: Update Docker Hub description if: ${{ github.event.action == 'released' }} uses: peter-evans/dockerhub-description@v3 diff --git a/app/build.gradle.kts b/app/build.gradle.kts index bb68b61..cb00094 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -84,9 +84,14 @@ spotless { quarkus { set("native.container-build", "true") - set("container-image.build", "true") set("container-image.group", "dnl50") set("container-image.name", "tsa-server") - set("package.type", "native") + set("container-image.tag", objects.property().value(provider { + if (project.hasProperty("imageTagSuffix")) { + "${project.version}-${project.property("imageTagSuffix")}" + } else { + project.version.toString() + } + })) finalName.set("tsa-${project.version}") } diff --git a/app/src/main/docker/Dockerfile.jvm b/app/src/main/docker/Dockerfile.jvm new file mode 100644 index 0000000..1a81c6c --- /dev/null +++ b/app/src/main/docker/Dockerfile.jvm @@ -0,0 +1,23 @@ +# Based on Quarkus' Dockerfile.jvm template for Gradle +FROM registry.access.redhat.com/ubi8/openjdk-21-runtime:1.19 + +ENV LANGUAGE='en_US:en' + +# We make four distinct layers so if there are application changes the library layers can be re-used +COPY --chown=185 build/quarkus-app/lib/ /deployments/lib/ +COPY --chown=185 build/quarkus-app/*.jar /deployments/ +COPY --chown=185 build/quarkus-app/app/ /deployments/app/ +COPY --chown=185 build/quarkus-app/quarkus/ /deployments/quarkus/ + +USER root +RUN mkdir -p /work/data \ + && chown -R 185:root /work + +EXPOSE 8080 +USER 185 +ENV JAVA_OPTS_APPEND="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +ENV JAVA_APP_JAR="/deployments/quarkus-run.jar" + +VOLUME ["/work/data"] + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 8b437bd..e644113 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ