I have the following functions defined in my TypeScript build:
containerBackend(): Container {
const src = this.source;
return dag
.container()
.from("sbtscala/scala-sbt:eclipse-temurin-alpine-24.0.1_9_1.11.7_3.7.4")
.withMountedCache("/root/.sbt", dag.cacheVolume("sbt-cache"))
.withMountedCache("/root/.ivy2", dag.cacheVolume("ivy2-cache"))
.withMountedCache("/root/.cache/coursier", dag.cacheVolume("scala-coursier-cache"))
.withDirectory("/workspace", src.directory("backend").filter({ include: ["project/build.properties", "project/plugins.sbt", "project/*.scala", "src/**", ".sbtopts", ".scalafmt.conf", "build.sbt"]}))
.withWorkdir("/workspace");
}
Now the next calls use this container:
const backendJar = await this.containerBackend()
.withExec(["sbt", "assembly"])
.file("target/scala-3.7.4/backend-assembly-1.0.jar");
After that this Jar is used for Graal optimization, however every time this sbt assembly is being repeated while the contents of src.directory("backend").filter({ include: ["project/build.properties", "project/plugins.sbt", "project/*.scala", "src/**", ".sbtopts", ".scalafmt.conf", "build.sbt"]}) haven't changed
So questions are
- Can you turn on debugging/tracing to see what causes the cache miss ?
- Are there specific calls which makes the build not hermetic? Are these documented?