diff --git a/docker/Dockerfile.app b/docker/Dockerfile.app index db5f307f..d9e205ff 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 \