-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathDockerfile
More file actions
46 lines (35 loc) · 1.42 KB
/
Dockerfile
File metadata and controls
46 lines (35 loc) · 1.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
####
# Multi-stage Dockerfile for building and running the Quarkus application in JVM mode
#
# Build and run the container using:
#
# docker build -t quarkus/submit-jvm .
# docker run -i --rm -p 8080:8080 quarkus/submit-jvm
#
###
# Stage 1: Build the application
FROM registry.access.redhat.com/ubi8/openjdk-21:1.20 AS builder
USER root
WORKDIR /build
# Copy Maven wrapper and pom.xml first for better layer caching
COPY --chown=185 mvnw pom.xml ./
COPY --chown=185 .mvn .mvn
# Download dependencies (cached if pom.xml unchanged)
RUN ./mvnw dependency:go-offline -B
# Copy source code
COPY --chown=185 src src
# Build the application
RUN ./mvnw package -DskipTests -B
# Stage 2: Runtime image
FROM registry.access.redhat.com/ubi8/openjdk-21:1.20
ENV LANGUAGE='en_US:en'
# We make four distinct layers so if there are application changes the library layers can be re-used
COPY --from=builder --chown=185 /build/target/quarkus-app/lib/ /deployments/lib/
COPY --from=builder --chown=185 /build/target/quarkus-app/*.jar /deployments/
COPY --from=builder --chown=185 /build/target/quarkus-app/app/ /deployments/app/
COPY --from=builder --chown=185 /build/target/quarkus-app/quarkus/ /deployments/quarkus/
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"
ENTRYPOINT [ "/opt/jboss/container/java/run/run-java.sh" ]