2

I have the following scenario.

I have a backup extract, this exists in a local folder ./app_backup. Example directory structure inside this:

./app_backup/plugins/plugin1
./app_backup/plugins/plugin2
./app_backup/plugins/plugin3
./app_backup/src/a
./app_backup/src/b
./app_backup/assets/mine.jpg
./app_backup/.../lots/more/...

I also have a local dir ./plugins that holds local plugins I'm actively developing. It looks something like this:

./plugins/pluginX
./plugins/pluginY

This whole structure needs to get mounted into a container. I'm doing this via compose.

(if there is a naming conflict, the folder in ./plugins should take precedence over the one in the backup)

I need these to all mount together to a main plugin dir INSIDE the container once it spins up, the paths will be something like this desired result inside the container:

/app/main/plugins/plugin1
/app/main/plugins/plugin2
/app/main/plugins/plugin3
/app/main/plugins/pluginX
/app/main/plugins/pluginY

Naturally, the compose file for the container can simply do this:

volumes:
  - ./app_backup/:/app/main/
  - ./plugins/pluginX:/app/main/plugins/pluginX
  - ./plugins/pluginY:/app/main/plugins/pluginY

However, I do not always know the quantity or name of the local plugins, it can be dynamic so I can't explicitly define each plugin subdir in the compose file

For example, one developer could have ./plugins/pluginX and another could have 10 different ones of different names such as ./plugins/pluginABC.

Therefore I need to just mount the entire ./plugins/ dir since we will never know explicitly which dirs are inside it.

Something like this:

volumes:
  - ./app_backup:/app/main
  - ./plugins:/app/main/plugins

This inherently creates another issue, if I mount ./plugins then the entire /app/main/plugins (that came from app_backup) gets overwritten!

So right now I'm stuck making the devs update the compose file for every single plugin they are developing. This is a pain point as they're constantly needing to edit their compose file!

Please let me know if what I'm trying to do is even possible, and if not, what's some suggested course of actions to ease up this workflow. Thanks!

If the volume mount allowed for "subdirs-only" such as ./plugins/* I think it would solve my problem but I don't think it works like that. I hope I'm wrong.

EDIT:

Ugly workaround:

  1. Each plugin has its own compose file. The only thing this compose file does is handle the individual mount path.
  2. Find occurrences of: ./plugins/*/docker-compose.yml
  3. Include those files with docker-compose -f when starting the service.

I would really like to not have to handle a compose file for each service, but this at least accomplishes the goal.

emmdee
  • 1,935
  • 9
  • 35
  • 56

0 Answers0