heartwood every commit a ring

Cache vendor crates across Docker builds via BuildKit cache mounts

c53ad63f by Isaac Bythewood · 6 days ago

Cache vendor crates across Docker builds via BuildKit cache mounts

Cuts rebuild time from ~5min to ~60s by mounting persistent caches at
/usr/local/cargo/registry and /app/target so cargo only recompiles the
blog crate itself when source changes.
modified Dockerfile
@@ -1,3 +1,4 @@# syntax=docker/dockerfile:1# ----- builder -----FROM rust:alpine AS builder
@@ -12,7 +13,10 @@ COPY src ./srcCOPY frontend ./frontendRUN cd frontend && bun install --frozen-lockfile && bun run buildRUN cargo build --releaseRUN --mount=type=cache,target=/usr/local/cargo/registry \    --mount=type=cache,target=/app/target \    cargo build --release && \    cp target/release/blog /app/blog# ----- runtime -----FROM alpine:3.23
@@ -22,7 +26,7 @@ RUN apk add --no-cache \WORKDIR /appCOPY --from=builder /app/target/release/blog ./blogCOPY --from=builder /app/blog ./blogCOPY --from=builder /app/dist ./distCOPY templates ./templatesCOPY content ./content