Skip to content

gaju-01/LicenseConfigurationService

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Getting Started

Reference Documentation

For further reference, please consider the following sections:

Guides

The following guides illustrate how to use some features concretely:

Maven Parent overrides

Due to Maven's design, elements are inherited from the parent POM to the project POM. While most of the inheritance is fine, it also inherits unwanted elements like <license> and <developers> from the parent. To prevent this, the project POM contains empty overrides for these elements. If you manually switch to a different parent and actually want the inheritance, you need to remove those overrides.

Docker

This project utilizes a multi-stage Docker build to efficiently create the application image. Instead of copying the entire jar file, the Dockerfile selectively copies the necessary dependencies, libraries, and compiled classes. This approach optimizes the build process and reduces the image size. The following dependency should be added to use the docker in our application,

<plugin>
  <groupId>com.spotify</groupId>
  <artifactId>dockerfile-maven-plugin</artifactId>
  <version>1.4.13</version>
</plugin>

Building the docker image

  • Use mvn clean command to remove all files generated by the previous build, such as the target directory. This ensures a fresh start for subsequent builds, eliminating any potential issues caused by leftover artifacts.
  • Use mvn package command which compiles the project and packages the compiled code into its distributable format, typically a JAR or WAR file, depending on the project's configuration. This step also includes running tests and placing the packaged output in the target directory.
  • Use mvn dockerfile:build command to build a Docker image for the application as specified in the Dockerfile. This command integrates Docker with Maven, automating the process of packaging the application into a Docker container. It typically uses the plugin spotify/dockerfile-maven-plugin as mentioned above or a similar one, and after execution, a Docker image is created and ready for deployment or further use.

Running the container

  • Use docker images to display a list of all Docker images available on your local machine, providing key details such as the image repository name, tag (used to identify different versions), image ID (a unique identifier for each image), the date the image was created, and its size. This command is essential for managing local images, verifying successful builds, and ensuring you have the correct versions of images ready for deployment or other tasks.
  • Use docker run <image_id> command to create and start a container from a specified Docker image. When executed, it initializes a container based on the image and can include options to configure the container's behavior, such as port mapping (-p), environment variables (-e), volumes (-v), and whether the container runs in the background (-d). For example, docker run -d -p 8080:80 my-app would start a container from the my-app image, running it in detached mode and mapping port 8080 on the host to port 80 in the container.
  • Use docker ps command to display a list of currently running Docker containers, showing important details like the container ID, the image used to create the container, the command that initiated it, when the container was started, its current status, port mappings, and the container name. By default, it displays only active containers, but using the -a option reveals all containers, including those that have stopped. This command is essential for monitoring and managing running containers.
  • Use docker compose up command to start or create all the services defined in a docker-compose.yml file, bringing up containers, networks, and volumes as specified. It handles the orchestration of multiple containers, allowing them to interact according to the configuration.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published