LINE1 10 20 30 40 50 60 701# 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 reuses the dependency artifacts and7# recompiles only the local crate. A cold machine pays one full dependency8# build; every build after that is warm.9#10# `ino` reads the LABEL lines in the final stage: `remote` names the image it11# pushes, and the `ino.deploy.*` pair tells the Ino server which app to update.1213FROM rust:slim-bookworm AS builder1415WORKDIR /app1617COPY Cargo.toml Cargo.lock ./18COPY assets ./assets19COPY src ./src2021# `target/` lives in the cache mount and is therefore not part of the layer,22# so the binary is copied out before the mount is unmounted.23RUN --mount=type=cache,target=/usr/local/cargo/registry,sharing=locked \24 --mount=type=cache,target=/app/target,sharing=locked \25 cargo build --release --locked \26 && cp target/release/me /usr/local/bin/me2728# Runtime stage29FROM debian:bookworm-slim3031LABEL remote="silenloc/me" \32 ino.deploy.server="https://ino.silenlocatelli.ch" \33 ino.deploy.host="me.silenlocatelli.ch"3435WORKDIR /app3637RUN apt-get update \38 && apt-get install -y --no-install-recommends ca-certificates \39 && rm -rf /var/lib/apt/lists/*4041COPY --from=builder /usr/local/bin/me /app/me4243# Expose port 8044EXPOSE 804546# Run the binary47ENTRYPOINT ["./me"]