Hey All,
I have a small pipeline where I build something with Bazel inside a container:
runner := client.Container(dagger.ContainerOpts{Platform: "linux/arm64"}).
From("ubuntu:22.04").
WithExec([]string{"apt-get", "update", "-yq"}).
WithExec([]string{"apt-get", "install", "-yq", "ca-certificates", "git", "gcc"}).
WithExec([]string{
"mkdir", "-p", "/root/.cache",
})
_, err = runner.
WithDirectory("/workspace", client.Host().Directory("."),
dagger.ContainerWithDirectoryOpts{
Exclude: []string{"bazel-*"},
}).
WithWorkdir("/workspace").
WithMountedCache("/root/.cache/", client.CacheVolume("cache")).
WithExec([]string{
"du", "-d", "2", "-h", "/root/.cache/",
}).
WithExec([]string{
"./bazel.sh",
"build",
"--repository_cache=/root/.cache/bazel/repository",
"--disk_cache=/root/.cache/bazel/disk",
"//cmd/myapp",
}).
Sync(ctx)
I'm using WithMountedCache to cache artifacts that Bazel produces in cache volume but on subsequent runs /root/.cache is always empty. Is that expected? If not, what could be the reason?