Skip to content

thiagojacinto/first-steps-docker-with-spring

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

First steps Docker with Spring Boot development

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

Necessary adaptations to use DevTools's Remote Live Reload:

< pom.xml >

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>

application.properties

Just set a secret to allow Remote connection by adding this configuration spring.devtools.remote.secret=YOUR_SECRET.

RUN CONFIGURATION

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

Acknowledgements

@algaworks: "Usando Docker para criar um ambiente de desenvolvimento" (video)