build native image
This commit is contained in:
parent
8cb5c78497
commit
c944982d19
3
pom.xml
3
pom.xml
@ -132,6 +132,7 @@
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>native</id>
|
||||
|
||||
<activation>
|
||||
<property>
|
||||
<name>native</name>
|
||||
@ -162,6 +163,8 @@
|
||||
</build>
|
||||
<properties>
|
||||
<quarkus.package.type>native</quarkus.package.type>
|
||||
<quarkus.native.additional-build-args>-H:ResourceConfigurationFiles=resources-config.json</quarkus.native.additional-build-args>
|
||||
<quarkus.package.type>native</quarkus.package.type>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
57
src/main/docker/Dockerfile.multistage
Normal file
57
src/main/docker/Dockerfile.multistage
Normal file
@ -0,0 +1,57 @@
|
||||
####
|
||||
# This Dockerfile is used in order to build a container that runs the Quarkus application in native (no JVM) mode.
|
||||
#
|
||||
# Before building the container image run:
|
||||
#
|
||||
# ./mvnw package -Pnative
|
||||
#
|
||||
# Then, build the image with:
|
||||
#
|
||||
# docker build -f src/main/docker/Dockerfile.multistage -t quarkus/covas-quarkus .
|
||||
#
|
||||
# Then run the container using:
|
||||
#
|
||||
# docker run -i --rm -p 8080:8080 quarkus/covas-quarkus
|
||||
#
|
||||
###
|
||||
|
||||
## Stage 1 : build with maven builder image with native capabilities
|
||||
FROM quay.io/quarkus/ubi-quarkus-native-image:22.2.0-java17 AS build
|
||||
COPY --chown=quarkus:quarkus mvnw /code/mvnw
|
||||
COPY --chown=quarkus:quarkus .mvn/ /code/.mvn
|
||||
COPY --chown=quarkus:quarkus pom.xml /code/
|
||||
USER quarkus
|
||||
WORKDIR /code
|
||||
RUN ./mvnw -B org.apache.maven.plugins:maven-dependency-plugin:3.1.2:go-offline
|
||||
COPY --chown=quarkus:quarkus src/ /code/src
|
||||
|
||||
ENV POSTGRES_PASSWORD toto
|
||||
ENV POSTGRES_USER toto
|
||||
ENV POSTGRES_DB toto
|
||||
ENV POSTGRES_URL db.valczeryba.ovh
|
||||
ENV POSTGRES_PORT 54321
|
||||
ENV REDIS_URL redis.valczeryba.ovh
|
||||
ENV REDIS_PORT 63791
|
||||
RUN ls -l src/*/*/*/
|
||||
|
||||
RUN ./mvnw package -Pnative
|
||||
FROM registry.access.redhat.com/ubi8/ubi-minimal:8.5
|
||||
WORKDIR /work/
|
||||
COPY --from=build /code/target/*-runner /work/application
|
||||
RUN chown 1001 /work \
|
||||
&& chmod "g+rwX" /work \
|
||||
&& chown 1001:root /work
|
||||
|
||||
|
||||
EXPOSE 8080
|
||||
USER 1001
|
||||
|
||||
ENV POSTGRES_PASSWORD toto
|
||||
ENV POSTGRES_USER toto
|
||||
ENV POSTGRES_DB toto
|
||||
ENV POSTGRES_URL db.valczeryba.ovh
|
||||
ENV POSTGRES_PORT 54321
|
||||
ENV REDIS_URL redis.valczeryba.ovh
|
||||
ENV REDIS_PORT 63791
|
||||
|
||||
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]
|
@ -15,12 +15,14 @@ import javax.ws.rs.core.Response;
|
||||
import com.covas.Entity.UsersEntity;
|
||||
|
||||
import io.quarkus.mailer.MailTemplate;
|
||||
import io.quarkus.qute.Location;
|
||||
import io.quarkus.redis.client.RedisClient;
|
||||
|
||||
@Path("mail")
|
||||
public class MailRessource {
|
||||
|
||||
@Inject
|
||||
@Location("mailer")
|
||||
private MailTemplate mailer;
|
||||
|
||||
@Inject
|
||||
|
@ -1,5 +1,7 @@
|
||||
smallrye.jwt.sign.key.location=privateKey.pem
|
||||
|
||||
quarkus.native.additional-build-args =-H:ResourceConfigurationFiles=resources-config.json
|
||||
|
||||
|
||||
mp.jwt.verify.publickey.location=publicKey.pem
|
||||
mp.jwt.verify.issuer=https://example.com/issuer
|
||||
|
20
src/main/resources/resources-config.json
Normal file
20
src/main/resources/resources-config.json
Normal file
@ -0,0 +1,20 @@
|
||||
{
|
||||
"resources": [
|
||||
{
|
||||
"pattern": ".*\\.pem$"
|
||||
},
|
||||
{
|
||||
"pattern": "templates/mailer.txt"
|
||||
},
|
||||
{
|
||||
"pattern": "application.properties"
|
||||
},
|
||||
{
|
||||
"pattern": "quarkus-runtime-config-defaults.properties"
|
||||
},
|
||||
|
||||
{
|
||||
"pattern": ".*\\.json$"
|
||||
}
|
||||
]
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user