Skip to content

Add Docker Compose support#247

Merged
jarlah merged 3 commits intomainfrom
add-docker-compose-support
Mar 17, 2026
Merged

Add Docker Compose support#247
jarlah merged 3 commits intomainfrom
add-docker-compose-support

Conversation

@jarlah
Copy link
Member

@jarlah jarlah commented Mar 16, 2026

Summary

  • Adds Docker Compose file support via CLI subprocess (docker compose up/down/ps), enabling multi-service test environments from docker-compose.yml files
  • New modules: DockerCompose (builder struct), Compose.Cli (subprocess wrapper), ComposeService (service data), ComposeEnvironment (started state with service/port accessors)
  • Integrates with existing GenServer (start_compose/stop_compose) and ExUnit (compose/3 macro) following established patterns
  • Supports per-service wait strategies by bridging to existing WaitStrategy protocol via Docker API container lookup

Test plan

  • 42 unit tests for CLI command building, JSON parsing, and builder functions
  • Integration test: full lifecycle with Redis (start compose, verify TCP connectivity, stop)
  • Multi-service compose test: PostgreSQL + Redis in phoenix example project, verifying both services start and are connectable
  • ExUnit compose/3 macro with shared: true: single environment shared across multiple tests (setup_all)
  • ExUnit compose/3 macro with shared: false: fresh environment per test (setup)

🤖 Generated with Claude Code

Introduces Docker Compose file support via CLI subprocess, enabling
multi-service test environments from docker-compose.yml files.

New modules:
- DockerCompose: builder struct for compose configuration
- Compose.Cli: subprocess wrapper for docker compose commands
- Compose.ComposeService: lightweight service representation
- Compose.ComposeEnvironment: started state with service accessors

Integration with existing GenServer (start_compose/stop_compose) and
ExUnit (compose/3 macro) following established patterns. Supports
per-service wait strategies by bridging to existing WaitStrategy protocol.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jarlah jarlah added the enhancement New feature or request label Mar 16, 2026
@jarlah
Copy link
Member Author

jarlah commented Mar 16, 2026

@gossi take a look if you have time? i havent really got the time to test in a real project with relative dependency path, so im thinking about just getting these two PRs reviewed and merged, and then test in a 2.1.0-rc1 or something. using semver for what its worth ...

@jarlah jarlah linked an issue Mar 16, 2026 that may be closed by this pull request
@jarlah
Copy link
Member Author

jarlah commented Mar 16, 2026

Ah silly me. I can enhance one of the example projects to test docker compose ✅

jarlah and others added 2 commits March 17, 2026 06:44
Adds a test that verifies Docker Compose can start a PostgreSQL service
and that it is reachable via Postgrex from the phoenix example project.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Multi-service compose file with PostgreSQL and Redis
- Test compose/3 macro with shared: true (setup_all)
- Test compose/3 macro with shared: false (per-test setup)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@jarlah
Copy link
Member Author

jarlah commented Mar 17, 2026

im squashing and merging this. And the other PR. And making a 2.1.0-rc1, to test with

@jarlah jarlah merged commit c61dcbf into main Mar 17, 2026
8 checks passed
@jarlah jarlah deleted the add-docker-compose-support branch March 17, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

docker compose support

1 participant