Docker ready dev environment with Spring Boot.
- initiate a simple Spring Boot app;
- create a simple docker image;
- configure Dockerfile;
- build that docker image;
- get docker up and running;
- run configuration to handle dev modifications & live reload
We know DevTools scope is at runtime. So, we have to configure to exclude DevTools from the build by doing something like that:
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludeDevtools>false</excludeDevtools>
</configuration>
</plugin>
</plugins>
</build>
Just set a secret to allow Remote connection by adding this configuration spring.devtools.remote.secret=YOUR_SECRET
.
It's necessary to adapt a RUN CONFIGURATION inside the IDE (Eclipse, IntelliJ) to run the following Main class:
org.springframework.boot.devtools.RemoteSpringApplication
And the PROGRAM ARGUMENTS must include the address of the app container, in this example: http://localhost:8081
@algaworks: "Usando Docker para criar um ambiente de desenvolvimento" (video)