How to manage shared dependencies in a monorepo while using dev containers?

113 Views Asked by At

At my current job we're using devcontainers for our local development. The main reasoning behind this is to avoid the problems of slightly different configurations on local machines that lead to inconsistencies when building/running the application.

The app is currently not very big but I can already foresee issues when it comes to building our containers for development and production. The structure of our app is something like this:

project-root

|__ front-end (TS+React)
|__ crud-backend (TS+node)
|__ shared-lib(TS & python)
|__ python-service
|__ different-python-service

Mostly concerned with the TS side of stuff since there is transpiling going on.

Our dockerfiles are bringing in the shared library doing something like shared-lib:latest as shared-lib and then copying and linking using yarn. Then the compose file is using volume mounts to keep the files synced between all the containers. While this isn't too bad at this point we recently added another lib (which is a fork of a now unmaintained npm package) that shared-lib depends on. Adding this seemed to be a quite a headache. Is there an easier way to manage local dependencies on shared libraries or is using Docker making it harder for ourselves than it needs to be? Has anyone worked in a similar setup before and had a good solution? Let me know!

0

There are 0 best solutions below