Repository navigation
[BREAKING] Add multi-project support via subdirectory mounting and compose overrides - #4
Merged
Merged
Conversation
- Add docker-compose.yml template with devcontainer service configuration - Update devcontainer.json to use dockerComposeFile instead of direct image/mounts - Move container configuration (image, volumes, environment) to docker-compose.yml - Update TestDevContainerJson: remove image test, add dockerComposeFile and service tests - Add TestDevContainerDockerCompose class with comprehensive docker-compose.yml tests
- update tests - update setup script
Changed devcontainer to mount projects into /workspace/<project_name>
subdirectory rather than directly to /workspace.
Key changes:
- Set workspaceFolder to /workspace/{{SHORT_NAME}}
- Mount using relative path (..) to subdirectory in docker-compose volumes
- Update scripts path to match new structure
- Remove redundant env vars from docker-compose
- Remove PRE_COMMIT_HOME from base image (now project-specific)
- Update tests
Implements support for mounting additional folders using standard Docker Compose override files. This enables e.g. multi-project development, shared libraries, and reference material mounting without modifying committed configuration. New files: - MOUNTS.md: Comprehensive documentation with examples - docker-compose.override.yml.example: Template with common patterns - .devcontainer/.gitignore: Ignores user-specific override files Changes: - README.md: Added mounting section with quick start - conftest.py: Test fixture creates and tests override functionality - test_integration.py: 4 integration tests verify mount operations Features: - Standard Docker Compose override pattern - Per-developer customization (gitignored) - Full integration test coverage - Documentation with troubleshooting guide Closes #3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements the ability to mount projects in subdirectories of
/workspaceinstead of directly at/workspace. This enables multi-project development by allowing multiple repositories to be mounted simultaneously in a single devcontainer.The implementation includes:
/workspace/<project_name>subdirectory structureRelated Issue(s)
Closes #3
Type of Change
Changes Made
Core Mount Structure Changes
/workspaceto/workspace/<project_name>subdirectoryworkspaceFolderin devcontainer.json to/workspace/{{SHORT_NAME}}docker-compose.ymlto use relative path (..) for project mountingpostAttachCommandpath to match new subdirectory structureinit-git.sh,init-precommit.sh,setup-git-conf.sh,post-attach.sh)Environment Variable Cleanup
PYTHONUNBUFFEREDandIN_CONTAINERfrom docker-compose.yml (inherited from base image)PRE_COMMIT_HOMEfrom Containerfile (now project-specific, set in docker-compose.yml)PROJECT_ROOTenvironment variable for script consistencyDocker Compose Override Support
.devcontainer/.gitignoreto ignore user-specific override filesdocker-compose.override.yml.exampletemplate with common mount patternsMOUNTS.mddocumentation (169 lines) covering:Testing Infrastructure
conftest.pyfixture to test override functionality:TestDockerComposeOverridetest class with 4 integration tests:Test Updates
..) in volumes/workspaceto/workspace/test_projecttest_pre_commit_home_setfrom image tests (no longer in base image)containerEnvin devcontainer.jsonTesting
make test)make test-image)make test-integration)make test-registry) (if applicable)Manual Testing Details
/workspace/<project_name>correctlydocker-compose.override.yml:init-git.sh,init-precommit.sh,post-attach.sh) run without errorsChecklist
[Unreleased]sectionAdditional Notes
Breaking Change Notice
This is a breaking change from any previous devcontainer setup (though no official release exists yet). Projects using the old structure will need to:
.devcontainerconfiguration with the new template/workspaceto use the new subdirectory structureKey Implementation Details
Mount Resolution: The implementation uses
..(relative path) instead of${localWorkspaceFolder}because:${localWorkspaceFolder}correctly with podman-compose.devcontainerdirectoryOverride File Handling: For the devcontainer CLI to use override files, they must be explicitly listed in
devcontainer.json:"dockerComposeFile": [
"docker-compose.yml",
"docker-compose.override.yml"
]VS Code's Dev Containers extension handles this automatically, but manual CLI usage requires explicit configuration.
Benefits