Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

IntelliJ Idea: build and run Java apps in docker containers

In my project I'd like to containerize my Spring Boot applications not only on production environment but also locally. In order to do that I'd like to:

  1. Start docker container (from a java image)
  2. Click "run" in IntelliJ Idea
  3. Build the application in the container (not using my local machine compiler but the one that is in the container)
  4. Run the application in the container

Is such scenario possible? I do not want to use Gradle or Maven to build the application in the container - I want to tell IntelliJ Idea to use the inside docker container java compiler, not the one that i have locally.

like image 499
gajos Avatar asked Apr 14 '16 10:04

gajos


1 Answers

What might be helpful is described here. Basically you need devtools and run a spring-boot application inside a docker container - musn't be done via java -jar ... - rather with maven or gradle plugins. Then setup a java application configuration with RemoteSpringApplication class and it should work.

Unfortunately I've experienced some problems, see this question.

like image 92
Opal Avatar answered Oct 23 '22 19:10

Opal