I have created a maven archetype which generates a microprofile application. The generated application is a REST web service and is packaged as a wildfly bootable jar. The archetype is published to the maven central and you can find it here : https://search.maven.org/search?q=a:wildfly-bootable-jaxrs-archetype
In order to create the microprofile application, you can simply execute the following maven command :
mvn archetype:generate -DarchetypeArtifactId=wildfly-bootable-jaxrs-archetype -DarchetypeGroupId=gr.sergouniotis -DarchetypeVersion=1.0.0
Alternatively, if you want to create the project in a batch mode ( i.e. non-interactive mode ) you must provide the groupId, the artifactId and the version coordinates e.g.
mvn -B archetype:generate -DarchetypeArtifactId=wildfly-bootable-jaxrs-archetype -DarchetypeGroupId=gr.sergouniotis -DarchetypeVersion=1.0.0 -DgroupId=foo -DartifactId=foo -Dversion=1.0.0 -Dpackage=foo
The generated maven project will also include the Dockerfile for the docker image creation.
cd foo && mvn clean install
The above command will also create the respective docker image for the microprofile application.
In order to run the container from the generated image :
docker run --rm -p 8080:8080 --name foo foo/foo:1.0.0
Finally, after the container started, you can verify the application by making a call to /hello endpoint :
curl -X GET http://localhost:8080/hello
Someone who’s interested in finding more details about the Wildfly bootable jar , can also read the previous post : https://www.sergouniotis.gr/2021/05/13/a-sample-microprofile-application-using-wildfly-bootable-jar/