covas-quarkus/Dockerfile

58 lines
1.5 KiB
Docker

####
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode
#
# Build the image with:
#
# docker build -f src/main/docker/Dockerfile.multistage -t quarkus/rest-json .
#
# Then run the container using:
#
# docker run -i --rm -p 8080:8080 quarkus/rest-json
#
###
FROM quay.io/quarkus/centos-quarkus-maven:21.3.0-java11 AS build
USER quarkus
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
ARG POSTGRES_PASSWORD
ARG POSTGRES_USER
ARG POSTGRES_DB
ARG POSTGRES_URL
ARG POSTGRES_PORT
ARG REDIS_URL
ARG REDIS_PORT
ARG MAILER_FROM
ARG MAILER_HOST
ARG MAILER_PORT
ARG MAILER_USERNAME
ARG MAILER_PASSWORD
ENV RESOURCES /project/resources/resources-config.json
RUN mvn -Pnative package
FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/
COPY --from=build /project/target/*-runner /work/application
RUN mkdir /certificate; mkdir /resources
COPY --from=build /project/src/main/resources/publicKey.pem /certificate/
COPY --from=build /project/resources/resources-config.json /resources/
RUN chmod 755 /work
ARG POSTGRES_PASSWORD
ARG POSTGRES_USER
ARG POSTGRES_DB
ARG POSTGRES_URL
ARG POSTGRES_PORT
ARG REDIS_URL
ARG REDIS_PORT
ARG MAILER_FROM
ARG MAILER_HOST
ARG MAILER_PORT
ARG MAILER_USERNAME
ARG MAILER_PASSWORD
ARG RESOURCES
EXPOSE 8080
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]