Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
kicktipp opened this issue May 10, 2024 · 1 comment
Closed

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

kicktipp opened this issue May 10, 2024 · 1 comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply

Comments

@kicktipp
Copy link

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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label May 10, 2024
@philwebb philwebb added the for: team-meeting An issue we'd like to discuss as a team to make progress label May 21, 2024
@philwebb
Copy link
Member

Thanks for the suggestion, but we don't think searching down the tree for docker compose files is something we should do. It's likely to be a costly operation and it's possible that we might find multiple docker-compose.yml files.

There are a number of aspects in Spring Boot that rely on having a correctly set working directory. For example, finding external application.properties files or writing out a pid file. I think it might be worth raising this issue with Jetbrains to see if they can consider changing their configuration defaults for Spring Boot applications?

@philwebb philwebb closed this as not planned Won't fix, can't repro, duplicate, stale May 22, 2024
@philwebb philwebb added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged for: team-meeting An issue we'd like to discuss as a team to make progress labels May 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

3 participants