#Dagger best practices for dagger CI pipelines on Monorepos

1 messages · Page 1 of 1 (latest)

remote atlas
#

Hey folks are there any guides or best practises for using dagger pipelines to build monorepos?

I'm having a monorepo with golang/python/typescript – the services I want to build with dagger all depend on go.work/package.json/uv.lock files in the root + on other libs as well.
If I'm createing a dagger module inside services/a/.dagger to build the a service the context is bound to this directory.

So what's a good pattern best practise to daggerize this monorepo structure for CI?

stiff frigate
#

there's also follow-up discussions in discord about this. If you search for "monorepo" you'll find some interesting conversations here

remote atlas
#

Yea I've read that guide but I'm missing examples which files lib sharing

stiff frigate
# remote atlas Yea I've read that guide but I'm missing examples which files lib sharing

If I'm createing a dagger module inside services/a/.dagger to build the a service the context is bound to this directory.

this is not a restriction, you can still reference any files within the same monorepo even if your modules are in subfolder. Did you get this impression from any parts of our docs by any chance? We should fix that if that's the case

#

this is the section in the docs that explains it: https://docs.dagger.io/api/default-paths/#for-git-repositories

if you use / as default path within a module, that will reference the monorepo root. On the contraty, if you use ., that will be the directory where your module's dagger.json is located at.

It is possible to assign a default path for a Directory or File argument in a Dagger Function. Dagger will automatically use this default path when no value is specified for the argument. The Directory or File loaded in this manner is not merely a string, but the actual filesystem state of the directory or file.

remote atlas
#

Oh thanks I was not aware that / and . make a difference. I don't know what brought me to the assumption but I thought the module just has context of the modules directory and not the whole workspace

#

But it worked!