devcontainers / spec

Development Containers: Use a container as a full-featured development environment.
https://containers.dev
Creative Commons Attribution 4.0 International
3.62k stars 234 forks source link

Monorepo and git #323

Open theonelucas opened 1 year ago

theonelucas commented 1 year ago

Hi, I have a monorepo with a few projects in it, two of which are api and ui, each with it's own Dockerfile.

I can work on each service separately, but I don't have access to git as the .git directory is up in the dir tree, and outside the specific container.

Is there a recommended way to tackle this issue and have access to the git repo inside the container?

samruddhikhandale commented 1 year ago

Hi 👋

Have you looked at #workspacefolder-and-workspacemount ?

To use git and a monorepo in a dev container, you can use the workspaceMount and workspaceFolder properties in the devcontainer.json file to mount the parent directory of the project as a volume in the container and set the default workspace folder to a sub-folder under it.