X Tutup
Skip to content

Add OL_MOUNT_DIR support to compose.override.yaml for git worktree development#11921

Merged
cdrini merged 2 commits intomasterfrom
copilot/add-docker-compose-override
Feb 25, 2026
Merged

Add OL_MOUNT_DIR support to compose.override.yaml for git worktree development#11921
cdrini merged 2 commits intomasterfrom
copilot/add-docker-compose-override

Conversation

Copy link
Contributor

Copilot AI commented Feb 24, 2026

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

  • All - .:/openlibrary volume mounts in compose.override.yaml replaced with - ${OL_MOUNT_DIR:-.}:/openlibrary
  • Defaults to . (no behavior change for standard workflows)
  • When reviewing a PR in a worktree, set OL_MOUNT_DIR to the worktree path:
OL_MOUNT_DIR=../worktree-4065406e-11914-fix-issue-11910-ebook-toggle docker compose up -d

Testing

  1. Run docker compose up -d without setting OL_MOUNT_DIR — behavior unchanged, mounts current directory.
  2. Create a worktree: git worktree add ../worktree-test some-branch
  3. Run OL_MOUNT_DIR=../worktree-test docker compose up -d — container should serve the worktree's code.

Screenshot

N/A — no UI changes.

Stakeholders

Original prompt

This section details on the original issue you should resolve

<issue_title>Add docker compose override to support git worktree development</issue_title>
<issue_description>We need to be able to easily test PRs in worktrees. Currently, docker compose mounts the main repo at /openlibrary but worktrees are created as siblings (../worktree-xyz/) so they are not visible inside the container.

The solution is to add an environment variable OL_MOUNT_DIR to compose.override.yaml that defaults to . but can be overridden to mount a worktree instead.

Expected Behavior

This will enable:

OL_MOUNT_DIR=worktree-4065406e-11914-fix-issue-11910-ebook-toggle/ docker compose up -d

Implementation

Change compose.override.yaml volumes from:

- .:/openlibrary

To:

- ${OL_MOUNT_DIR:-.}:/openlibrary

Then when running in a worktree for PR review, simply set OL_MOUNT_DIR to the worktree path.


Related: This came up during PR #11914 review workflow</issue_description>

<agent_instructions>Please reference our docs/ai/README.md to guide development. This should be an easy fix; update the right docker compose file to support variable OL_MOUNT_DIR</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 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.

…tree support

Co-authored-by: mekarpeles <978325+mekarpeles@users.noreply.github.com>
Copilot AI changed the title [WIP] Add docker compose override for worktree development Add OL_MOUNT_DIR support to compose.override.yaml for git worktree development Feb 24, 2026
Copilot AI requested a review from mekarpeles February 24, 2026 22:44
@mekarpeles mekarpeles assigned cdrini and unassigned mekarpeles Feb 25, 2026
@mekarpeles mekarpeles marked this pull request as ready for review February 25, 2026 21:51
Copilot AI review requested due to automatic review settings February 25, 2026 21:51
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.yaml now use ${OL_MOUNT_DIR:-.}:/openlibrary instead of hardcoded .:/openlibrary
  • The variable defaults to . (current directory), preserving existing behavior
  • Developers can now set OL_MOUNT_DIR to a worktree path to mount different code

@mekarpeles mekarpeles added the Priority: 1 Do this week, receiving emails, time sensitive, . [managed] label Feb 25, 2026
Copy link
Collaborator

@cdrini cdrini left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

@cdrini cdrini merged commit e125237 into master Feb 25, 2026
11 checks passed
@cdrini cdrini deleted the copilot/add-docker-compose-override branch February 25, 2026 22:21
RayBB pushed a commit that referenced this pull request Feb 26, 2026
…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>
bhardwajparth51 pushed a commit to bhardwajparth51/openlibrary that referenced this pull request Mar 3, 2026
…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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: 1 Do this week, receiving emails, time sensitive, . [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add docker compose override to support git worktree development

4 participants

X Tutup