Create a docker image from a spring boot project

In order to create a docker image from a spring boot project, First, your pom.xml has to be configured. <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <!-- Cofiguration for creating a docker image --> <image> <name>chamow01/${project.artifactId}</name> </image> </configuration> </plugin> </plugins> </build> Then, the next maven command needs to be applied, so spring boot uses paketo-buildpacks in order to create a docker image based on you Java code mvn spring-boot:build-image ... [INFO] > Running creator [INFO] [creator] ===> DETECTING [INFO] [creator] 6 of 24 buildpacks participating [INFO] [creator] paketo-buildpacks/ca-certificates 3.2.0 [INFO] [creator] paketo-buildpacks/bellsoft-liberica 9.3.2 [INFO]

Configuración de perfiles en maven

Para configurar un perfil en mave, se debe utilizar las siguientes etiquetas:
<profiles>
   <profile>
      <id>nombre del perfil</id>
      <properties>      
      </properties>
   </profile>
</profiles>

Ejemplo:
<profiles>
   <profile>
      <id>dev5</id>
      <properties>
         <enviroment.name>DEV5</enviroment.name>
 <enviroment.version>2.6.0.5.RC1</enviroment.version>
      </properties>
   </profile>
</profiles>



Para ejecutar un perfil de maven, se puede utilizar el siguiente comando
mvn <opciones> -P <nombre del perfil>

Ejemplo:
mvn clean package deploy -P dev5



Comentarios

Entradas populares de este blog

Create a docker image from a spring boot project

Comandos docker

Kubernetes -Tipos de objetos