cachepot icon indicating copy to clipboard operation
cachepot copied to clipboard

Cache not created/hit when working with Docker

Open lcmgh opened this issue 3 years ago • 0 comments

FROM mybuilder # has cachepot preinstalled
ARG CARGO_PACKAGE
ENV RUSTC_WRAPPER=/usr/local/cargo/bin/cachepot
ENV CACHEPOT_DIR=/var/cache/cachepot
WORKDIR /build
COPY . /build
RUN --mount=type=cache,target=$CACHEPOT_DIR \
    cargo build --release --no-default-features --bin ${CARGO_PACKAGE}
 docker buildx build \
  -t mycontainer \
  --build-arg CARGO_PACKAGE="myapp" 
.

For some reason cachepot is not being used

#20 [builder 11/14] RUN cachepot --show-stats
#20 0.559 Compile requests                      0
#20 0.559 Compile requests executed             0
#20 0.559 Cache hits                            0
#20 0.559 Cache misses                          0
#20 0.559 Cache timeouts                        0
#20 0.559 Cache read errors                     0
#20 0.559 Forced recaches                       0
#20 0.559 Cache write errors                    0
#20 0.559 Compilation failures                  0
#20 0.559 Cache errors                          0
#20 0.559 Non-cacheable compilations            0
#20 0.559 Non-cacheable calls                   0
#20 0.559 Non-compilation calls                 0
#20 0.559 Unsupported compiler calls            0
#20 0.559 Average cache write               0.000 s
#20 0.559 Average cache read miss           0.000 s
#20 0.559 Average cache read hit            0.000 s
#20 0.559 Failed distributed compilations       0
#20 0.559 Cache location                  Local disk: "/var/cache/cachepot"
#20 0.559 Cache size                          184 MiB
#20 0.559 Max cache size                       10 GiB
#20 DONE 0.7s

/var/cache/cachepot is also empty on the host.

lcmgh avatar Nov 10 '22 12:11 lcmgh