spring-boot icon indicating copy to clipboard operation
spring-boot copied to clipboard

docker-compose should search directory tree for docker-compose.yml

Open kicktipp opened this issue 1 year ago • 0 comments

I would like to use docker-compose in my tests with

spring.docker.compose.skip.in-tests=false

Also I want to use docker-compose when I start my Spring Boot Application inside my Intellij IDE. When you have a multi module project the search for docker-compose.yml fails.

If you have a module "backend" in your "app" project like this:

/app/build.gradle.kts (Parent Project) /app/backend/build.gradle.kts (Spring Boot Project) /app/backend/docker-compose.yml /app/backend/src/main/java/BootApplication.java /app/backend/src/test/java/BootApplicationTest.java

When I run my test it searches for docker-compose.yml in /app/backend/ and finds the file. When I run BootApplication.java it searches in app/ and fails. At least thats the case in IntelliJ. The working directory might differ somewhere else.

Two workarounds:

  1. As I have two profiles (dev and integration), I can set the docker-compose file in application-dev.properties to

    spring.docker.compose.file=backend/docker-compose.yml

  2. Or I can set the working directory in my IntelliJ Run configuration

Maybe SpringBootApplication should search in its own project (app/backend) and not only in the current working directory.

kicktipp avatar May 10 '24 10:05 kicktipp