devcontainers / devcontainers/spec
Proposal: Allow linking to an different project's devcontainer
- Dominant language
- No language data
- Stars
- 5.7k
- Forks
- 496
- PR merge metrics
- No merged PRs in 30d
Description
In our environment we have many components to build together, they share the same development environment, today, each of those is a repo and have their own .devcontainer. Then vscode or devcontainer cli encounter those it create as many container as there are component (repo), etc.
In our environment we use the same devcontainer environment as to simplify things and as such, I was wondering if the specification could be enhanced as to "link" a project' devcontainer to a different one.
Something like:
repo1
.devcontainer/devcontainer.json:
{
"name": "myenv",
"image": "myimage"
}
repo2
devcontainer.json:
{
"link-url": github.com/myorg/repo1
}
This would then tell devcontainer that basically for this project, you need to consult the other repo location to find the .devcontainer and get the name of that container (i.e. "myenv") and re-use it instead of creating a new container name for the repo.
It would also then be possible to support a VSCode workspace with many folder as long as they all link to the same devcontainer.
My proposal is incomplete for sure, like for example we set the workspace folder to
"workspaceFolder": "/work/${localWorkspaceFolderBasename}"
So that it works for all case. In docker we try to mount the "parent" folder so that both repo1 and repo2 are accessible within the same devcontainer to make the work easier, etc.
So maybe "linking" is not the best way to do that, but "sharing" the devcontainer somehow is what I am looking for.
Contributor guide
Assessment
This issue has not been assessed yet.