Ensure Docker is installed and operational in your local environment.
- Automated fat JAR creation using the provided docker-full-build.Dockerfile.
- Alternative docker-no-build.Dockerfile for scenarios preferring the use of a pre-built fat JAR.
To construct the Docker image with the complete build process:
docker build -t krud-image -f ./docker-full-build.Dockerfile .
For using a pre-existing fat JAR (expected to be located in the build/libs directory):
docker build -t krud-image -f ./docker-no-build.Dockerfile .
Docker Compose simplifies setup and deployment by automating service build and initialization, as specified in the provided docker-compose.yaml, including port mapping and environment variable settings.
To deploy services with Docker Compose and ensure old unused containers are cleaned up:
docker-compose up --build --remove-orphans
To rebuild the Docker image and restart the container, use the --build
flag:
docker-compose build --no-cache
Note: The --build option forces the image to rebuild. The --remove-orphans flag removes containers for services not defined in the Compose file.
For users of IntelliJ IDEA Ultimate, many of these Docker and Docker Compose commands can be run directly from the IDE, which provides a convenient and integrated workflow for building images, starting services, and managing containers.
After the container is running, observe the console output. Once initialization is complete, you can test the server by opening a web browser and navigating to any of the following URLs: