2022-06-29 23:54:51 +02:00
|
|
|
####
|
2022-10-15 21:31:27 +02:00
|
|
|
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode
|
2022-06-29 23:54:51 +02:00
|
|
|
#
|
2022-10-15 21:31:27 +02:00
|
|
|
# Build the image with:
|
2022-06-29 23:54:51 +02:00
|
|
|
#
|
2022-10-15 21:31:27 +02:00
|
|
|
# docker build -f src/main/docker/Dockerfile.multistage -t quarkus/rest-json .
|
2022-06-29 23:54:51 +02:00
|
|
|
#
|
|
|
|
# Then run the container using:
|
|
|
|
#
|
2022-10-15 21:31:27 +02:00
|
|
|
# docker run -i --rm -p 8080:8080 quarkus/rest-json
|
2022-06-29 23:54:51 +02:00
|
|
|
#
|
|
|
|
###
|
|
|
|
|
2022-10-15 21:31:27 +02:00
|
|
|
FROM quay.io/quarkus/centos-quarkus-maven:21.3.0-java11 AS build
|
|
|
|
USER quarkus
|
2022-12-05 23:11:23 +01:00
|
|
|
RUN mkdir ./resources; pwd
|
|
|
|
COPY --chown=quarkus:quarkus ./pom.xml ./pom.xml
|
|
|
|
COPY --chown=quarkus:quarkus ./src ./src
|
|
|
|
COPY --chown=quarkus:quarkus ./src/main/resources/resources-config.json ./resources
|
2022-10-15 21:31:27 +02:00
|
|
|
ARG POSTGRES_PASSWORD
|
|
|
|
ARG POSTGRES_USER
|
|
|
|
ARG POSTGRES_DB
|
|
|
|
ARG POSTGRES_URL
|
|
|
|
ARG POSTGRES_PORT
|
|
|
|
ARG REDIS_URL
|
|
|
|
ARG REDIS_PORT
|
2022-11-02 22:37:29 +01:00
|
|
|
ARG MAILER_FROM
|
|
|
|
ARG MAILER_HOST
|
|
|
|
ARG MAILER_PORT
|
|
|
|
ARG MAILER_USERNAME
|
|
|
|
ARG MAILER_PASSWORD
|
2022-12-05 23:11:23 +01:00
|
|
|
ENV RESOURCES /project/resources/resources-config.json
|
2022-11-02 22:37:29 +01:00
|
|
|
|
2022-10-15 21:31:27 +02:00
|
|
|
RUN mvn -Pnative package
|
2022-06-29 23:54:51 +02:00
|
|
|
|
2022-10-15 21:31:27 +02:00
|
|
|
FROM registry.access.redhat.com/ubi8/ubi-minimal
|
|
|
|
WORKDIR /work/
|
|
|
|
COPY --from=build /project/target/*-runner /work/application
|
2022-12-05 23:11:23 +01:00
|
|
|
RUN mkdir /certificate; mkdir /resources
|
|
|
|
COPY --from=build /project/src/main/resources/publicKey.pem /certificate/
|
|
|
|
COPY --from=build /project/resources/resources-config.json /resources/
|
2022-10-15 21:31:27 +02:00
|
|
|
RUN chmod 755 /work
|
|
|
|
ARG POSTGRES_PASSWORD
|
|
|
|
ARG POSTGRES_USER
|
|
|
|
ARG POSTGRES_DB
|
|
|
|
ARG POSTGRES_URL
|
|
|
|
ARG POSTGRES_PORT
|
|
|
|
ARG REDIS_URL
|
2022-11-02 22:37:29 +01:00
|
|
|
ARG REDIS_PORT
|
|
|
|
ARG MAILER_FROM
|
|
|
|
ARG MAILER_HOST
|
|
|
|
ARG MAILER_PORT
|
|
|
|
ARG MAILER_USERNAME
|
|
|
|
ARG MAILER_PASSWORD
|
2022-12-05 23:11:23 +01:00
|
|
|
ARG RESOURCES
|
2022-06-29 23:54:51 +02:00
|
|
|
EXPOSE 8080
|
2022-12-05 23:11:23 +01:00
|
|
|
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
|