paritytech / cachepot

cachepot is `sccache` with extra sec, which in turn is `ccache` with cloud storage
https://cachepot.cc
Apache License 2.0
171 stars 13 forks source link

Cache not created/hit when working with Docker #171

Open lcmgh opened 1 year ago

lcmgh commented 1 year ago
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.