diff --git a/Dockerfile b/Dockerfile index f2f70c3..8312af8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -13,8 +13,10 @@ FROM quay.io/quarkus/centos-quarkus-maven:21.3.0-java11 AS build USER quarkus -COPY --chown=quarkus:quarkus ./pom.xml ./pom.xml -COPY --chown=quarkus:quarkus ./src ./src +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 @@ -27,12 +29,16 @@ 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 @@ -46,5 +52,6 @@ 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"] \ No newline at end of file +CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] diff --git a/build-image.sh b/build-image.sh index a21f73a..f468b94 100644 --- a/build-image.sh +++ b/build-image.sh @@ -1,3 +1,3 @@ #!/bin/bash source .env -docker build --build-arg MAILER_FROM=${MAILER_FROM} --build-arg MAILER_HOST=${MAILER_HOST} --build-arg MAILER_PORT=${MAILER_PORT} --build-arg MAILER_USERNAME=${MAILER_USERNAME} --build-arg MAILER_PASSWORD=${MAILER_PASSWORD} --build-arg POSTGRES_URL=${POSTGRES_URL} --build-arg POSTGRES_PORT=${POSTGRES_PORT} --build-arg POSTGRES_DB=${POSTGRES_DB} --build-arg POSTGRES_USER=${POSTGRES_USER} --build-arg POSTGRES_PASSWORD=${POSTGRES_PASSWORD} --build-arg REDIS_URL=${REDIS_URL} --build-arg REDIS_PORT=${REDIS_PORT} -t quarkus-native . +docker build --build-arg RESOURCES=${RESOURCES} --build-arg MAILER_FROM=${MAILER_FROM} --build-arg MAILER_HOST=${MAILER_HOST} --build-arg MAILER_PORT=${MAILER_PORT} --build-arg MAILER_USERNAME=${MAILER_USERNAME} --build-arg MAILER_PASSWORD=${MAILER_PASSWORD} --build-arg POSTGRES_URL=${POSTGRES_URL} --build-arg POSTGRES_PORT=${POSTGRES_PORT} --build-arg POSTGRES_DB=${POSTGRES_DB} --build-arg POSTGRES_USER=${POSTGRES_USER} --build-arg POSTGRES_PASSWORD=${POSTGRES_PASSWORD} --build-arg REDIS_URL=${REDIS_URL} --build-arg REDIS_PORT=${REDIS_PORT} -t quarkus-native . diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties index ca4bf9c..360aaec 100644 --- a/src/main/resources/application.properties +++ b/src/main/resources/application.properties @@ -1,6 +1,6 @@ smallrye.jwt.sign.key.location=privateKey.pem -mp.jwt.verify.publickey.location=publicKey.pem +mp.jwt.verify.publickey.location=${CERTIFICATE:publicKey.pem} mp.jwt.verify.issuer=https://example.com/issuer mp.jwt.token.header=Cookie mp.jwt.token.cookie=jwt @@ -23,11 +23,6 @@ quarkus.mailer.username=${MAILER_USERNAME:default@mail.com} quarkus.mailer.password=${MAILER_PASSWORD:default} quarkus.mailer.mock=false - - - - - quarkus.redis.hosts=redis://${REDIS_URL:localhost}:${REDIS_PORT:6379} quarkus.http.cors=true @@ -35,3 +30,6 @@ quarkus.http.origins=http://localhost:8084 quarkus.http.cors.methods=GET,PUT,POST,DELETE,PATCH quarkus.http.cors.headers=accept,authorization,content-type,x-requested-with,x-foobar quarkus.http.cors.access-control-allow-credentials=true + +#quarkus.native.additional-build-args=-H:IncludeResources=.*\\.pem,.\\*.txt +quarkus.native.additional-build-args=-H:ResourceConfigurationFiles=${RESOURCES:resource-config.json} \ No newline at end of file diff --git a/src/main/resources/resources-config.json b/src/main/resources/resources-config.json new file mode 100644 index 0000000..9eb6872 --- /dev/null +++ b/src/main/resources/resources-config.json @@ -0,0 +1,10 @@ +{ + "resources": [ + { + "pattern": ".*\\.pem" + }, + { + "pattern": ".*\\.txt" + } + ] + } \ No newline at end of file