LINE1 10 20 30 40 50 60 70 801# syntax=docker/dockerfile:12#3# Build strategy: BuildKit cache mounts instead of cargo-chef.4#5# The cargo registry and the `target/` directory are persisted in BuildKit6# cache mounts, so a release build only recompiles the `fig` crate itself —7# all 340+ dependency artifacts are reused from the previous build. That makes8# cargo-chef (and the `cargo install cargo-chef` + full `chef cook` passes it9# needs) redundant on a machine with a persistent BuildKit cache, which is how10# `mise run release` builds.11#12# Note: cache mounts are local to the BuildKit daemon. A cold machine (fresh13# CI runner) pays one full dependency build; every build after that is warm.1415FROM rust:slim-bookworm AS builder1617WORKDIR /app1819# mold links the final binary several times faster than GNU ld.20# gcc 12 (bookworm) drives it via -fuse-ld=mold, so no clang needed.21# No pkg-config/libssl-dev: git2 is built with default-features off and22# vendors libgit2, and nothing in the tree links OpenSSL.23RUN apt-get update \24 && apt-get install -y --no-install-recommends mold \25 && rm -rf /var/lib/apt/lists/*2627ENV RUSTFLAGS="-C link-arg=-fuse-ld=mold" \28 CARGO_INCREMENTAL=0 \29 CARGO_NET_RETRY=10 \30 CARGO_TERM_COLOR=always3132COPY Cargo.toml Cargo.lock ./33COPY assets ./assets34COPY plugin ./plugin35COPY src ./src36COPY dist ./dist3738# `mac/src-tauri` is a workspace member but is dockerignored, so39# members must be set to only ["."] or cargo refuses to load the workspace.40RUN sed -i 's/members = \[.*\]/members = ["."]/g' Cargo.toml4142# `target/` lives in the cache mount and is therefore not part of the layer —43# the binary has to be copied out before the mount is unmounted.44RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \45 --mount=type=cache,target=/app/target,sharing=locked \46 cargo build --release \47 && cp target/release/notify /usr/local/bin/notify4849# Runtime stage50FROM debian:bookworm-slim5152LABEL remote="silenloc/notify"5354WORKDIR /app5556# ca-certificates: turso sync talks HTTPS through rustls, which can be57# configured to read system roots. No git/openssl in the runtime: the tree has58# no git2 dependency, and vendored libgit2 (if reintroduced) brings its own TLS.59RUN apt-get update \60 && apt-get install -y --no-install-recommends ca-certificates \61 && rm -rf /var/lib/apt/lists/*6263COPY --from=builder /usr/local/bin/notify /app/notify64COPY --from=builder /app/dist /app/dist65ENV NOTIFY_DIST_DIR=/app/dist6667# DB state lives on a volume, not in a layer: it must survive container68# replacement. `DB_PATH` is relocated to /app/data so the volume only holds69# mutable state, never the binary.70# Point a named volume at /app/data to keep data across upgrades.71ENV DB_PATH=/app/data/notify.db72RUN mkdir -p /app/data \73 && chmod 755 /app/data74VOLUME ["/app/data"]7576# Default PORT is 8080 (see src/config.rs); override with `-e PORT=...`77EXPOSE 80807879# Run the binary80ENTRYPOINT ["./notify"]