Add resources files

This commit is contained in:
Valentin CZERYBA 2022-12-05 23:11:23 +01:00
parent b7d72d7c02
commit e669ee0d55
4 changed files with 25 additions and 10 deletions

View File

@ -13,8 +13,10 @@
FROM quay.io/quarkus/centos-quarkus-maven:21.3.0-java11 AS build FROM quay.io/quarkus/centos-quarkus-maven:21.3.0-java11 AS build
USER quarkus USER quarkus
COPY --chown=quarkus:quarkus ./pom.xml ./pom.xml RUN mkdir ./resources; pwd
COPY --chown=quarkus:quarkus ./src ./src 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_PASSWORD
ARG POSTGRES_USER ARG POSTGRES_USER
ARG POSTGRES_DB ARG POSTGRES_DB
@ -27,12 +29,16 @@ ARG MAILER_HOST
ARG MAILER_PORT ARG MAILER_PORT
ARG MAILER_USERNAME ARG MAILER_USERNAME
ARG MAILER_PASSWORD ARG MAILER_PASSWORD
ENV RESOURCES /project/resources/resources-config.json
RUN mvn -Pnative package RUN mvn -Pnative package
FROM registry.access.redhat.com/ubi8/ubi-minimal FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/ WORKDIR /work/
COPY --from=build /project/target/*-runner /work/application 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 RUN chmod 755 /work
ARG POSTGRES_PASSWORD ARG POSTGRES_PASSWORD
ARG POSTGRES_USER ARG POSTGRES_USER
@ -46,5 +52,6 @@ ARG MAILER_HOST
ARG MAILER_PORT ARG MAILER_PORT
ARG MAILER_USERNAME ARG MAILER_USERNAME
ARG MAILER_PASSWORD ARG MAILER_PASSWORD
ARG RESOURCES
EXPOSE 8080 EXPOSE 8080
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"] CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
source .env 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 .

View File

@ -1,6 +1,6 @@
smallrye.jwt.sign.key.location=privateKey.pem 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.verify.issuer=https://example.com/issuer
mp.jwt.token.header=Cookie mp.jwt.token.header=Cookie
mp.jwt.token.cookie=jwt 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.password=${MAILER_PASSWORD:default}
quarkus.mailer.mock=false quarkus.mailer.mock=false
quarkus.redis.hosts=redis://${REDIS_URL:localhost}:${REDIS_PORT:6379} quarkus.redis.hosts=redis://${REDIS_URL:localhost}:${REDIS_PORT:6379}
quarkus.http.cors=true 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.methods=GET,PUT,POST,DELETE,PATCH
quarkus.http.cors.headers=accept,authorization,content-type,x-requested-with,x-foobar quarkus.http.cors.headers=accept,authorization,content-type,x-requested-with,x-foobar
quarkus.http.cors.access-control-allow-credentials=true 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}

View File

@ -0,0 +1,10 @@
{
"resources": [
{
"pattern": ".*\\.pem"
},
{
"pattern": ".*\\.txt"
}
]
}