5

Having a monorepo with multiple ddev projects and a shared composer packages folder, I would like to mount additional folders into the webcontainers.

I am trying to develop a set of TYPO3 extensions and test them with v9 and v10 simultaneously, for this I created two ddev projects inside one git repository and one packages folder containing my extensions. Path relative ddev composer will not see my packages folder though, as it is outside the mount root. Symlinking doesn't work cross docker boundaries. So I would like to use docker facilities to mount an additional directory into the ddev web container.

Is there some good way to do so?

ksjogo
  • 53
  • 3
  • How are you adding the extensions into both projects? If you are using a `path`-repository and symlinking does not work, you can pass in an option to use hard copies instead. This means that changes in the extensions are not automatically available in the projects, but might solve at least that issue. Maybe adding more details like the rough directory structure and an outline of the composer.jsons might help finding a better answer. – dbrumann Aug 09 '19 at 11:10

2 Answers2

16

You can add additional mounts in ddev by creating a new docker-composer yaml configuration file in .ddev, for example .ddev/docker-compose.mounts.yaml with the following content:

services:
  web:
    volumes:
    - "$HOME/mydirectory:/home/mydirectory"

This will mount the local mydirectory directory in my home directory to /home/mydirectory inside ddev's docker container.

rfay
  • 9,963
  • 1
  • 47
  • 89
Rudy Gnodde
  • 4,286
  • 2
  • 12
  • 34
  • 1
    This is a great answer and a wonderful technique for people to know about. Thanks! – rfay Aug 09 '19 at 15:20
3

When doing the above answer with enabled mutagen, there will be an error about a scan crossed filesystem boundary. To avoid this, edit .ddev/mutagen/mutagen.yaml: Remove the leading #ddev-generated and add an additional path-entry like - "/home/mydirectory".

rtoenjes
  • 56
  • 3