Skip to content

Commit

Permalink
Replace Jib with Docker for image builds
Browse files Browse the repository at this point in the history
  • Loading branch information
xstefank committed Feb 28, 2024
1 parent cc6cfb5 commit 4800cbb
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-container-image-jib</artifactId>
<artifactId>quarkus-container-image-docker</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
Expand Down
15 changes: 10 additions & 5 deletions src/main/docker/Dockerfile.jvm
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
#
Expand Down Expand Up @@ -75,20 +77,23 @@
# 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
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" ]

13 changes: 8 additions & 5 deletions src/main/docker/Dockerfile.legacy-jar
Original file line number Diff line number Diff line change
Expand Up @@ -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 :
#
Expand Down Expand Up @@ -75,16 +77,17 @@
# 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/
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" ]
6 changes: 3 additions & 3 deletions src/main/docker/Dockerfile.native
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Before building the container image run:
#
# ./mvnw package -Pnative
# ./mvnw package -Dnative
#
# Then, build the image with:
#
Expand All @@ -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 \
Expand All @@ -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"]
6 changes: 3 additions & 3 deletions src/main/docker/Dockerfile.native-micro
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#
# Before building the container image run:
#
# ./mvnw package -Pnative
# ./mvnw package -Dnative
#
# Then, build the image with:
#
Expand All @@ -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 \
Expand All @@ -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"]
3 changes: 0 additions & 3 deletions src/main/resources/application.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4800cbb

Please sign in to comment.