Add OL_MOUNT_DIR support to compose.override.yaml for git worktree development#11921
Add OL_MOUNT_DIR support to compose.override.yaml for git worktree development#11921
Conversation
…tree support Co-authored-by: mekarpeles <978325+mekarpeles@users.noreply.github.com>
There was a problem hiding this comment.
Pull request overview
This PR adds support for git worktree development to the Docker Compose setup by introducing the OL_MOUNT_DIR environment variable. This enables developers to easily review and test pull requests in separate worktrees without the worktree path being invisible to Docker containers.
Changes:
- All volume mount points in
compose.override.yamlnow use${OL_MOUNT_DIR:-.}:/openlibraryinstead of hardcoded.:/openlibrary - The variable defaults to
.(current directory), preserving existing behavior - Developers can now set
OL_MOUNT_DIRto a worktree path to mount different code
cdrini
left a comment
There was a problem hiding this comment.
Niiiice the approach looks good to me! There's one small gotcha which we should be aware of, which is that with this approach, the volumes for the build files and the node modules are going to be shared across all the work trees. This isn't ideal, but not sure of a better approach. Maybe having a separate web container per worktree somehow? Or subdirs in the static build? Regardless, this is a step in the right direction!
…velopment (#11921) * Initial plan * feat: add OL_MOUNT_DIR variable to compose.override.yaml for git worktree support Co-authored-by: mekarpeles <978325+mekarpeles@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mekarpeles <978325+mekarpeles@users.noreply.github.com>
…velopment (internetarchive#11921) * Initial plan * feat: add OL_MOUNT_DIR variable to compose.override.yaml for git worktree support Co-authored-by: mekarpeles <978325+mekarpeles@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: mekarpeles <978325+mekarpeles@users.noreply.github.com>
Docker Compose hard-coded
.as the repo mount source, making it impossible to use git worktrees for PR review since worktrees live outside the container's visible path.Technical
- .:/openlibraryvolume mounts incompose.override.yamlreplaced with- ${OL_MOUNT_DIR:-.}:/openlibrary.(no behavior change for standard workflows)OL_MOUNT_DIRto the worktree path:Testing
docker compose up -dwithout settingOL_MOUNT_DIR— behavior unchanged, mounts current directory.git worktree add ../worktree-test some-branchOL_MOUNT_DIR=../worktree-test docker compose up -d— container should serve the worktree's code.Screenshot
N/A — no UI changes.
Stakeholders
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.