From 4c6adbadd4356a72f87c121e49089a721364c2de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Henning?= <soeren.henning@email.uni-kiel.de> Date: Sat, 22 Jan 2022 13:58:35 +0100 Subject: [PATCH] Upgrade Quarkus version to 2.6 --- theodolite/README.md | 18 +++++------ theodolite/build.gradle | 6 ++-- theodolite/build_jvm.sh | 6 ---- theodolite/build_native.sh | 6 ---- theodolite/gradle.properties | 6 ++-- theodolite/src/main/docker/Dockerfile.jvm | 32 ++++++------------- .../src/main/docker/Dockerfile.legacy-jar | 26 ++++----------- theodolite/src/main/docker/Dockerfile.native | 12 +++---- .../main/docker/Dockerfile.native-distroless | 3 +- 9 files changed, 37 insertions(+), 78 deletions(-) delete mode 100755 theodolite/build_jvm.sh delete mode 100755 theodolite/build_native.sh diff --git a/theodolite/README.md b/theodolite/README.md index 96f56c20d..eb50d4214 100644 --- a/theodolite/README.md +++ b/theodolite/README.md @@ -1,12 +1,12 @@ -# Theodolite project +# Theodolite This project uses Quarkus, the Supersonic Subatomic Java Framework. -If you want to learn more about Quarkus, please visit its website: <https://quarkus.io/> . +If you want to learn more about Quarkus, please visit its website: https://quarkus.io/. ## Running the application in dev mode -You can run your application in dev mode using: +You can run your application in dev mode that enables live coding using: ```sh ./gradlew quarkusDev @@ -23,8 +23,10 @@ The application can be packaged using: ./gradlew build ``` -It produces the `theodolite-0.7.0-SNAPSHOT-runner.jar` file in the `/build` directory. Be aware that it’s not -an _über-jar_ as the dependencies are copied into the `build/lib` directory. +It produces the `quarkus-run.jar` file in the `build/quarkus-app/` directory. +Be aware that it’s not an _über-jar_ as the dependencies are copied into the `build/quarkus-app/lib/` directory. + +The application is now runnable using `java -jar build/quarkus-app/quarkus-run.jar`. If you want to build an _über-jar_, execute the following command: @@ -32,12 +34,10 @@ If you want to build an _über-jar_, execute the following command: ./gradlew build -Dquarkus.package.type=uber-jar ``` -The application is now runnable using `java -jar build/theodolite-0.7.0-SNAPSHOT-runner.jar`. +The application, packaged as an _über-jar_, is now runnable using `java -jar build/*-runner.jar`. ## Creating a native executable -It is recommended to use the native GraalVM images to create executable jars from Theodolite. For more information please visit the [Native Image guide](https://www.graalvm.org/reference-manual/native-image/). - You can create a native executable using: ```sh @@ -55,7 +55,7 @@ You can then execute your native executable with: If you want to learn more about building native executables, please consult https://quarkus.io/guides/gradle-tooling. -## Build docker images +## Building docker images For the jvm version use: diff --git a/theodolite/build.gradle b/theodolite/build.gradle index 0ec113cbb..a066e94f0 100644 --- a/theodolite/build.gradle +++ b/theodolite/build.gradle @@ -1,14 +1,14 @@ plugins { - id 'org.jetbrains.kotlin.jvm' version "1.5.31" - id "org.jetbrains.kotlin.plugin.allopen" version "1.5.31" + id 'org.jetbrains.kotlin.jvm' version "1.6.10" + id "org.jetbrains.kotlin.plugin.allopen" version "1.6.10" id 'io.quarkus' id "io.gitlab.arturbosch.detekt" version "1.15.0" id "org.jlleitschuh.gradle.ktlint" version "10.0.0" } repositories { - mavenLocal() mavenCentral() + mavenLocal() jcenter() } diff --git a/theodolite/build_jvm.sh b/theodolite/build_jvm.sh deleted file mode 100755 index f4dd32fc5..000000000 --- a/theodolite/build_jvm.sh +++ /dev/null @@ -1,6 +0,0 @@ - -./gradlew build -x test - -docker build -f src/main/docker/Dockerfile.jvm -t quarkus/theodolite-jvm . - -docker run -i --rm -p 8080:8080 quarkus/theodolite-jvm diff --git a/theodolite/build_native.sh b/theodolite/build_native.sh deleted file mode 100755 index c2d7d81f3..000000000 --- a/theodolite/build_native.sh +++ /dev/null @@ -1,6 +0,0 @@ - -./gradlew build -Dquarkus.package.type=native -x test - -docker build -f src/main/docker/Dockerfile.native -t quarkus/theodolite . - -docker run -i --rm -p 8080:8080 quarkus/theodolite diff --git a/theodolite/gradle.properties b/theodolite/gradle.properties index 76ed8f213..fd5768bc2 100644 --- a/theodolite/gradle.properties +++ b/theodolite/gradle.properties @@ -1,8 +1,8 @@ #Gradle properties -quarkusPluginVersion=2.5.2.Final -quarkusPlatformArtifactId=quarkus-bom quarkusPluginId=io.quarkus +quarkusPluginVersion=2.6.3.Final quarkusPlatformGroupId=io.quarkus.platform -quarkusPlatformVersion=2.5.2.Final +quarkusPlatformArtifactId=quarkus-bom +quarkusPlatformVersion=2.6.3.Final #org.gradle.logging.level=INFO \ No newline at end of file diff --git a/theodolite/src/main/docker/Dockerfile.jvm b/theodolite/src/main/docker/Dockerfile.jvm index 030357520..e33d7c379 100644 --- a/theodolite/src/main/docker/Dockerfile.jvm +++ b/theodolite/src/main/docker/Dockerfile.jvm @@ -18,38 +18,24 @@ # # Then run the container using : # -# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/theodolite-jvm +# docker run -i --rm -p 8080:8080 quarkus/theodolite-jvm # ### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 +FROM registry.access.redhat.com/ubi8/openjdk-11-runtime:1.10 -ARG JAVA_PACKAGE=java-11-openjdk-headless -ARG RUN_JAVA_VERSION=1.3.8 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' -# Install java and the run-java script -# Also set up permissions for user `1001` -RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ - && microdnf update \ - && microdnf clean all \ - && mkdir /deployments \ - && chown 1001 /deployments \ - && chmod "g+rwX" /deployments \ - && chown 1001:root /deployments \ - && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ - && chown 1001 /deployments/run-java.sh \ - && chmod 540 /deployments/run-java.sh \ - && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security # Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" + # We make four distinct layers so if there are application changes the library layers can be re-used -COPY --chown=1001 build/quarkus-app/lib/ /deployments/lib/ -COPY --chown=1001 build/quarkus-app/*.jar /deployments/ -COPY --chown=1001 build/quarkus-app/app/ /deployments/app/ -COPY --chown=1001 build/quarkus-app/quarkus/ /deployments/quarkus/ +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/ EXPOSE 8080 -USER 1001 +USER 185 -ENTRYPOINT [ "/deployments/run-java.sh" ] +ENTRYPOINT [ "java", "-jar", "/deployments/quarkus-run.jar" ] diff --git a/theodolite/src/main/docker/Dockerfile.legacy-jar b/theodolite/src/main/docker/Dockerfile.legacy-jar index f9dffd188..aa5908c4e 100644 --- a/theodolite/src/main/docker/Dockerfile.legacy-jar +++ b/theodolite/src/main/docker/Dockerfile.legacy-jar @@ -18,34 +18,20 @@ # # Then run the container using : # -# docker run -i --rm -p 8080:8080 -p 5005:5005 -e JAVA_ENABLE_DEBUG="true" quarkus/theodolite-legacy-jar +# docker run -i --rm -p 8080:8080 quarkus/theodolite-legacy-jar # ### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 +FROM registry.access.redhat.com/ubi8/openjdk-11-runtime:1.10 -ARG JAVA_PACKAGE=java-11-openjdk-headless -ARG RUN_JAVA_VERSION=1.3.8 ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' -# Install java and the run-java script -# Also set up permissions for user `1001` -RUN microdnf install curl ca-certificates ${JAVA_PACKAGE} \ - && microdnf update \ - && microdnf clean all \ - && mkdir /deployments \ - && chown 1001 /deployments \ - && chmod "g+rwX" /deployments \ - && chown 1001:root /deployments \ - && curl https://repo1.maven.org/maven2/io/fabric8/run-java-sh/${RUN_JAVA_VERSION}/run-java-sh-${RUN_JAVA_VERSION}-sh.sh -o /deployments/run-java.sh \ - && chown 1001 /deployments/run-java.sh \ - && chmod 540 /deployments/run-java.sh \ - && echo "securerandom.source=file:/dev/urandom" >> /etc/alternatives/jre/conf/security/java.security # Configure the JAVA_OPTIONS, you can add -XshowSettings:vm to also display the heap size. ENV JAVA_OPTIONS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" + COPY build/lib/* /deployments/lib/ -COPY build/*-runner.jar /deployments/app.jar +COPY build/*-runner.jar /deployments/quarkus-run.jar EXPOSE 8080 -USER 1001 +USER 185 -ENTRYPOINT [ "/deployments/run-java.sh" ] +ENTRYPOINT [ "java", "-jar", "/deployments/quarkus-run.jar" ] diff --git a/theodolite/src/main/docker/Dockerfile.native b/theodolite/src/main/docker/Dockerfile.native index 04a1dd6f2..34ccd6622 100644 --- a/theodolite/src/main/docker/Dockerfile.native +++ b/theodolite/src/main/docker/Dockerfile.native @@ -14,12 +14,12 @@ # docker run -i --rm -p 8080:8080 quarkus/theodolite # ### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.4 -WORKDIR /deployments/ -RUN chown 1001 /deployments \ - && chmod "g+rwX" /deployments \ - && chown 1001:root /deployments -COPY --chown=1001:root build/*-runner /deployments/application +FROM quay.io/quarkus/quarkus-micro-image:1.0 +WORKDIR /work/ +RUN chown 1001 /work \ + && chmod "g+rwX" /work \ + && chown 1001:root /work +COPY --chown=1001:root build/*-runner /work/application EXPOSE 8080 USER 1001 diff --git a/theodolite/src/main/docker/Dockerfile.native-distroless b/theodolite/src/main/docker/Dockerfile.native-distroless index 1ed64110d..951dfb64b 100644 --- a/theodolite/src/main/docker/Dockerfile.native-distroless +++ b/theodolite/src/main/docker/Dockerfile.native-distroless @@ -15,8 +15,7 @@ # ### FROM quay.io/quarkus/quarkus-distroless-image:1.0 -WORKDIR /deployments/ -COPY build/*-runner /deployments/application +COPY build/*-runner /application EXPOSE 8080 USER nonroot -- GitLab