Skip to content

Open-source LLM knowledge platform: turn raw documents into a queryable RAG, an autonomous reasoning agent, and a self-maintaining Wiki.

build(docker): mount the Go build cache when building the app image (#4320)

tayadwx9a7aa48e4494
diff --git a/docker/Dockerfile.app b/docker/Dockerfile.app
index db5f307fe..d9e205ff5 100644
--- a/docker/Dockerfile.app
+++ b/docker/Dockerfile.app
@@ -86,8 +86,14 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \
./scripts/build-anydoc-lib.sh; \
fi
-# Build the application with version info
+# Build the application with version info. Mount the Go build cache as well as
+# the module cache: `COPY . .` invalidates this layer on every source change,
+# and without the mount each rebuild regenerates the whole compile cache inside
+# the layer (~2.7 GB), which occupies disk locally and is uploaded to the CI
+# layer cache. Mounted, the cache lives outside the layer and repeated builds
+# reuse compiled objects instead of recompiling from scratch.
RUN --mount=type=cache,target=/go/pkg/mod \
+ --mount=type=cache,target=/root/.cache/go-build \
if [ "$WITH_ANYDOC" = "1" ]; then \
make build-prod GO_BUILD_TAGS=anydoc; \
else \