Skip to content

Simple demo showed in the TOTVS Meetup about GraalVM and Quarkus.

License

Notifications You must be signed in to change notification settings

thiagoasw/totvs-meetup-graal-quarkus

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

TOTVS Meetup: GraalVM & Quarkus

Simple demo showed in the TOTVS Meetup about GraalVM and Quarkus.

Create the base web project

mvn io.quarkus:quarkus-maven-plugin:0.20.0:create -DprojectGroupId="com.tasw.meetup" -DprojectArtifactId="graalvm-quarkus" -DclassName="com.tasw.meetup.graalvm.quarkus.GreetingResource" -Dpath="/hello"

Build the native image

cd .\graalvm-quarkus\

For Windows OS generate a Dockerfile.multistage file at src/main/docker/ with this content:

cd . > ./src/main/docker/Dockerfile.multistage
## Stage 1 : build with maven builder image with native capabilities
FROM quay.io/quarkus/centos-quarkus-maven:19.1.1 AS build
COPY src /usr/src/app/src
COPY pom.xml /usr/src/app
USER root
RUN chown -R quarkus /usr/src/app
USER quarkus
RUN mvn -f /usr/src/app/pom.xml -Pnative clean package

## Stage 2 : create the docker final image
FROM registry.access.redhat.com/ubi8/ubi-minimal
WORKDIR /work/
COPY --from=build /usr/src/app/target/*-runner /work/application
RUN chmod 775 /work
EXPOSE 8080
CMD ["./application", "-Dquarkus.http.host=0.0.0.0"]

Remove the .dockerignore.

rm .\.dockerignore

Build the native image.

docker build -f src/main/docker/Dockerfile.multistage -t totvs-meetup/graal-quarkus .

Inspect the generated image

docker image ls totvs-meetup/graal-quarkus

Run the native image

docker run -i --rm -p 8080:8080 totvs-meetup/graal-quarkus

Run with less memory...

docker run -i --rm --memory=20m -p 8080:8080 totvs-meetup/graal-quarkus

Watch the container stats

docker stats $(docker ps -q)

About

Simple demo showed in the TOTVS Meetup about GraalVM and Quarkus.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published