Refactor Docker Compose file naming to avoid V2 precedence conflict#69
Refactor Docker Compose file naming to avoid V2 precedence conflict#69devondragon merged 4 commits intomainfrom
Conversation
…#68) Docker Compose V2 prioritizes compose.yaml over docker-compose.yml, which conflicted with using compose.yaml for Spring Boot's Docker Compose integration (dev-only) and docker-compose.yml for the full stack. - Rename compose.yaml -> compose.dev.yaml (dev dependencies for bootRun) - Rename docker-compose.yml -> compose.yaml (full deployable stack) - Add spring.docker.compose.file=compose.dev.yaml to application-local.yml-example - Update README.md with compose file descriptions and docker compose v2 syntax
There was a problem hiding this comment.
Pull request overview
Refactors Docker Compose file naming to avoid Docker Compose V2 precedence issues by separating the dev-only Compose stack used by Spring Boot from the full deployable stack, and updates documentation/configuration accordingly.
Changes:
- Renames/migrates dev-only Compose setup into
compose.dev.yamland makescompose.yamlthe full deployable stack. - Updates
application-local.yml-exampleto point Spring Boot Docker Compose integration atcompose.dev.yaml. - Updates README and CHANGELOG with the new filenames and Docker Compose V2 CLI syntax.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
src/main/resources/application-local.yml-example |
Adds spring.docker.compose.file=compose.dev.yaml to direct Spring Boot to the dev Compose file. |
docker-compose.yml |
Removes the legacy full-stack Compose file (migrated to compose.yaml). |
compose.yaml |
Becomes the default full-stack Compose file (app + DB + mailserver). |
compose.dev.yaml |
Adds a dev-only Compose file (database only) for bootRun/local development. |
README.md |
Updates Compose usage docs (file descriptions + docker compose CLI syntax). |
CHANGELOG.md |
Documents the Compose naming refactor. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| spring: | ||
| docker: | ||
| compose: | ||
| file: compose.dev.yaml |
There was a problem hiding this comment.
application-local.yml-example is currently invalid YAML: logging.level.org.springframework.web is set to the scalar DEBUG but then filter: is indented beneath it. YAML scalars can’t have child keys, so Spring won’t be able to parse this file when someone copies it to application-local.yml. Restructure the logging section (e.g., make web: a map containing filter, or flatten the key) so the example config is parseable.
|
|
||
| services: | ||
| mariadb: | ||
| image: mariadb:12.2 |
There was a problem hiding this comment.
compose.dev.yaml uses mariadb:12.2 while the other compose stacks (compose.yaml, docker-compose-keycloak.yml) use mariadb:11.6.2. Using different major/minor versions between local bootRun and the full stack can cause schema/behavior drift and “works locally but not in Docker” issues. Consider aligning the MariaDB image version across compose files (or document why they intentionally differ).
| image: mariadb:12.2 | |
| image: mariadb:11.6.2 |
compose.yaml
Outdated
| SPRING_MAIL_PROPERTIES_MAIL_SMTP_STARTTLS_ENABLE: "false" | ||
| SPRING_MAIL_PROPERTIES_MAIL_SMTP_STARTTLS_REQUIRED: "false" | ||
| healthcheck: | ||
| test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"] |
There was a problem hiding this comment.
The myapp-main healthcheck runs curl, but the Dockerfile installs and uses wget for health checks (and doesn’t install curl explicitly). This can make the Compose healthcheck fail and mark the app as unhealthy even when it’s running. Update the Compose healthcheck to use wget (or install curl in the image) so the healthcheck command matches what’s available in the container.
| test: ["CMD", "curl", "-f", "http://localhost:8080/actuator/health"] | |
| test: ["CMD", "wget", "-qO-", "http://localhost:8080/actuator/health"] |
- Fix invalid YAML in application-local.yml-example: flatten CommonsRequestLoggingFilter key so web: remains a valid scalar and filter config is a sibling key - Align MariaDB version to 11.6.2 in compose.dev.yaml to match compose.yaml - Fix compose.yaml app healthcheck to use wget (installed in Dockerfile) instead of curl
Summary
compose.yaml→compose.dev.yaml(dev dependencies forbootRun) anddocker-compose.yml→compose.yaml(full deployable stack) to resolve Docker Compose V2 precedence conflictspring.docker.compose.file=compose.dev.yamltoapplication-local.yml-exampleso Spring Boot finds the dev compose fileCloses #68
Test plan
./gradlew bootRunwithlocalprofile picks upcompose.dev.yamland starts the dev databasedocker compose up --buildusescompose.yamland starts the full stack (app + db + mail)docker compose -f docker-compose-keycloak.yml up --buildstill works for the Keycloak stack