#Single file caching

1 messages · Page 1 of 1 (latest)

wary rapids
#

Hi all. I want to ask if there is a way to cache only one file. In my case, I am using dagger in a Node project with Yarn Plug'n'Play, which generates a single .pnp.cjs file instead of the usual node_modules. I want to add that file, in conjunction with the .cache folder to avoid repeating the installation. But I do not find the proper way to do it. Thanks in advance. Also I am using the Node SDK

exotic cape
#

Hello! Is it not being cached now? Or is it that you want to exclude most other things and only include that?

wary rapids
#

I understood that this cache feature in dagger is activated only on directories mounted using the Container.withMountedCache() method. I use that previously to cache the node_modules, but now with pnp.cjs files I cannot figure it out. So, maybe I misunderstood the caching system?

iron vigil
#

@wary rapids similarly to the docker buildx API, cache mounting doesn't support files. What you can do though, is mount a cache volume and then copy the .pnp.cjs from/to the cache to your working dir before and after running your pipelines. I've tried searching to see if yarn can be configured to store the .pnp.cjs file somewhere else than the project root but it seems it's not possible

odd verge
iron vigil
#

@wary rapids can we close?