-
Notifications
You must be signed in to change notification settings - Fork 39
/
Dockerfile-qu
35 lines (32 loc) · 1.8 KB
/
Dockerfile-qu
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
FROM maven:3-openjdk-17 AS builder
COPY ./pom.quarkus.xml /code/pom.xml
RUN mvn -f /code/pom.xml -B de.qaware.maven:go-offline-maven-plugin:resolve-dependencies
COPY src /code/src
COPY src/main/java/com/acmeair/mongo/MongoProducer.java.quarkus.native /code/src/main/java/com/acmeair/mongo/MongoProducer.java
WORKDIR /code
RUN mvn -Dmaven.test.skip -DskipTests=true -Dquarkus.package.type=mutable-jar -B de.qaware.maven:go-offline-maven-plugin:resolve-dependencies clean package
FROM registry.access.redhat.com/ubi8/ubi-minimal
ARG JAVA_PACKAGE=java-17-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/lib/security/java.security
ENV JAVA_OPTIONS="-Dquarkus.http.port=9080 -Dquarkus.http.host=0.0.0.0 -Djava.util.logging.manager=org.jboss.logmanager.LogManager"
COPY --chown=1001 --from=builder /code/target/quarkus-app/lib/ /deployments/lib/
COPY --chown=1001 --from=builder /code/target/quarkus-app/*.jar /deployments/
COPY --chown=1001 --from=builder /code/target/quarkus-app/app/ /deployments/app/
COPY --chown=1001 --from=builder /code/target/quarkus-app/quarkus/ /deployments/quarkus/
EXPOSE 8080
USER 1001
ENTRYPOINT [ "/deployments/run-java.sh" ]