#Can you export a directory from a cache volume?

1 messages · Page 1 of 1 (latest)

wheat ice
#

Essentially something like:

func (m *Something) CacheTest(source *dagger.Directory) *dagger.Directory {
    cache := dag.CacheVolume("node-modules")

    buildContainer := dag.Container(dagger.ContainerOpts{
        Platform: dagger.Platform("linux/amd64"),
    }).From("node:18")

    return buildContainer.
        WithDirectory("/src", source).
        WithWorkdir("/src").
        WithMountedCache("/src/node_modules", cache).
        WithExec([]string{"npm", "install"}).
        WithExec([]string{"npm", "run", "build"}).
        Directory("/src/node_modules")
}

But that seems to result in a resolve: /src/node_modules: cannot retrieve path from cache