This repository demonstrates how to package a Java web application (WAR) and run it locally inside a Tomcat container using either Podman or Docker.
- Container Runtime: Either
podman(recommended) ordocker. - Environment Setup Tools:
vaultandjqare required for retrieving credentials during the build process. - Tomcat Runtime: Provided via a container image; no local Tomcat installation is needed.
- The included
Dockerfilesupports rootless runtime by passingUSER_IDandGROUP_IDas build arguments. Defaults are1000. - The build script (
build.sh) attempts to authenticate with Vault to retrieve Artifactory credentials. This is required for applications with custom dependencies hosted in Artifactory.
Run:
./build.sh --engine podmanor
./build.sh --engine=podmanRun:
./build.sh --engine dockeror
./build.sh --engine=dockerThis performs the same build process using Docker.
Run:
./run.sh podmanThis launches the application inside a Tomcat container.
podman logs --tail 200 myapp
curl -sS -D - http://localhost:8080/ -o /dev/nullExpected output: HTTP/1.1 200
podman exec myapp id -u
podman exec myapp id -gIf you want to change the default Tomcat port, JVM options or runtime user, then update .docker/runtime/Dockerfile and run.sh accordingly.
This repository uses the Polaris Pipeline to build and deploy.
Refer to nr-polaris-docs for more information about how to use the Polaris Pipeline.
NRM Architecture Confluence: GitHub Repository Best Practices