From d66f6270df4acdc3c012aea69352f0f0a3d5e3b6 Mon Sep 17 00:00:00 2001 From: xstefank Date: Wed, 28 Feb 2024 15:13:38 +0100 Subject: [PATCH] Replace Jib with Docker for image builds --- pom.xml | 2 +- src/main/docker/Dockerfile.jvm | 15 ++++++++++----- src/main/docker/Dockerfile.legacy-jar | 13 ++++++++----- src/main/docker/Dockerfile.native | 6 +++--- src/main/docker/Dockerfile.native-micro | 6 +++--- src/main/resources/application.properties | 3 --- 6 files changed, 25 insertions(+), 20 deletions(-) diff --git a/pom.xml b/pom.xml index 68ba44c..3dfafd9 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ io.quarkus - quarkus-container-image-jib + quarkus-container-image-docker io.quarkus diff --git a/src/main/docker/Dockerfile.jvm b/src/main/docker/Dockerfile.jvm index b8a57dd..8a0534c 100644 --- a/src/main/docker/Dockerfile.jvm +++ b/src/main/docker/Dockerfile.jvm @@ -14,7 +14,9 @@ # docker run -i --rm -p 8080:8080 quarkus/lra-coordinator-quarkus-jvm # # If you want to include the debug port into your docker image -# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005 +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container # # Then run the container using : # @@ -75,9 +77,9 @@ # accessed directly. (example: "foo.example.com,bar.example.com") # ### -FROM registry.access.redhat.com/ubi8/openjdk-11:1.11 +FROM registry.access.redhat.com/ubi8/openjdk-21:1.18 -ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' +ENV LANGUAGE='en_US:en' # We make four distinct layers so if there are application changes the library layers can be re-used @@ -85,10 +87,13 @@ COPY --chown=185 target/quarkus-app/lib/ /deployments/lib/ COPY --chown=185 target/quarkus-app/*.jar /deployments/ COPY --chown=185 target/quarkus-app/app/ /deployments/app/ COPY --chown=185 target/quarkus-app/quarkus/ /deployments/quarkus/ +# Change the ownership of the /deployments since this is where Narayana created the ObjectStore +RUN chown 185 /deployments EXPOSE 8080 USER 185 -ENV AB_JOLOKIA_OFF="" -ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +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" +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] + diff --git a/src/main/docker/Dockerfile.legacy-jar b/src/main/docker/Dockerfile.legacy-jar index 6ccb9ca..49614d8 100644 --- a/src/main/docker/Dockerfile.legacy-jar +++ b/src/main/docker/Dockerfile.legacy-jar @@ -14,7 +14,9 @@ # docker run -i --rm -p 8080:8080 quarkus/lra-coordinator-quarkus-legacy-jar # # If you want to include the debug port into your docker image -# you will have to expose the debug port (default 5005) like this : EXPOSE 8080 5005 +# you will have to expose the debug port (default 5005 being the default) like this : EXPOSE 8080 5005. +# Additionally you will have to set -e JAVA_DEBUG=true and -e JAVA_DEBUG_PORT=*:5005 +# when running the container # # Then run the container using : # @@ -75,9 +77,9 @@ # accessed directly. (example: "foo.example.com,bar.example.com") # ### -FROM registry.access.redhat.com/ubi8/openjdk-11:1.11 +FROM registry.access.redhat.com/ubi8/openjdk-21:1.18 -ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' +ENV LANGUAGE='en_US:en' COPY target/lib/* /deployments/lib/ @@ -85,6 +87,7 @@ COPY target/*-runner.jar /deployments/quarkus-run.jar EXPOSE 8080 USER 185 -ENV AB_JOLOKIA_OFF="" -ENV JAVA_OPTS="-Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager" +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" + +ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ] diff --git a/src/main/docker/Dockerfile.native b/src/main/docker/Dockerfile.native index baeac74..19966e8 100644 --- a/src/main/docker/Dockerfile.native +++ b/src/main/docker/Dockerfile.native @@ -3,7 +3,7 @@ # # Before building the container image run: # -# ./mvnw package -Pnative +# ./mvnw package -Dnative # # Then, build the image with: # @@ -14,7 +14,7 @@ # docker run -i --rm -p 8080:8080 quarkus/lra-coordinator-quarkus # ### -FROM registry.access.redhat.com/ubi8/ubi-minimal:8.5 +FROM registry.access.redhat.com/ubi8/ubi-minimal:8.9 WORKDIR /work/ RUN chown 1001 /work \ && chmod "g+rwX" /work \ @@ -24,4 +24,4 @@ COPY --chown=1001:root target/*-runner /work/application EXPOSE 8080 USER 1001 -CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/src/main/docker/Dockerfile.native-micro b/src/main/docker/Dockerfile.native-micro index 2837890..6135c9c 100644 --- a/src/main/docker/Dockerfile.native-micro +++ b/src/main/docker/Dockerfile.native-micro @@ -6,7 +6,7 @@ # # Before building the container image run: # -# ./mvnw package -Pnative +# ./mvnw package -Dnative # # Then, build the image with: # @@ -17,7 +17,7 @@ # docker run -i --rm -p 8080:8080 quarkus/lra-coordinator-quarkus # ### -FROM quay.io/quarkus/quarkus-micro-image:1.0 +FROM quay.io/quarkus/quarkus-micro-image:2.0 WORKDIR /work/ RUN chown 1001 /work \ && chmod "g+rwX" /work \ @@ -27,4 +27,4 @@ COPY --chown=1001:root target/*-runner /work/application EXPOSE 8080 USER 1001 -CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] +ENTRYPOINT ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index 2b4abfd..0d6a093 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -14,9 +14,6 @@ quarkus.container-image.group=jbosstm quarkus.container-image.name=lra-coordinator quarkus.container-image.additional-tags=latest -# 185 == jboss -quarkus.jib.user=185 - # jandex quarkus.index-dependency.microprofile-lra-api.group-id=org.eclipse.microprofile.lra quarkus.index-dependency.microprofile-lra-api.artifact-id=microprofile-lra-api