Issue
I am not sure if I keep my docker-compose.yml
file in the project root or in the resources
folder (I use Maven) where application.properties
file is also kept. So, what is the most proper way to keep docker-compose.yml
file in Spring Boot projects?
Solution
I am not sure if I keep my
docker-compose.yml
file in the project root or in theresources
folder (I use Maven) whereapplication.properties
file is also kept.
It does not seem to be the right directory, since the docker-compose.yml
file does not represent a resource: the file is not used programmatically.
So, what is the most proper way to keep
docker-compose.yml
file in Spring Boot projects?
It seems to be a matter of requirements (if any), convenience, or both.
It seems that the following directories are frequently used:
The root directories (let's denote them by
/
): repository root directory and project root directory.The
/docker
and/docker-compose
directories.The
<MAVEN_PROJECT_DIRECTORY>/src/main/docker
and<MAVEN_PROJECT_DIRECTORY>/src/main/docker-compose
directories.For example, these seem to be convenient when using Docker-related Maven plugins.
Additional references
GitHub search queries
- Organization:
spring-projects
, file name:docker-compose.yml
. Search · org:spring-projects filename:docker-compose.yml. - All GitHub, file name:
docker-compose.yml
. Search · filename:docker-compose.yml. - All GitHub, path:
src/main/docker
, file name:docker-compose.yml
. Search · path:src/main/docker filename:docker-compose.yml.
Answered By - Sergey Vyacheslavovich Brunov
Answer Checked By - David Goodson (JavaFixing Volunteer)