clone

one developer profile for links and private tcp services, reached peer to peer over iroh with no open ports

build: cache production image builds

Dami committed e71b0db
Separate web and Rust inputs, cache Cargo registry and target artifacts, and avoid reinstalling web build tools after source-only changes.
commit
e71b0dbde766b5588b3ae13d655c4f0c3e928c48
parent
c52e13769f877a0566c5cf47702bce5c954472a4
author
Dami <dami.etoile@gmail.com>
1 file changed, +18 -7
MDockerfile25++++++++++++++++++-------
M Dockerfile +18 -7
@@ -1,12 +1,17 @@
1+# syntax=docker/dockerfile:1.72+13 # Keep the checked-in web source readable and only minify the production copy.24 FROM node:24-bookworm-slim AS web35 46 WORKDIR /src5-COPY web ./web67 78 # Versions are exact so rebuilding a commit cannot silently change its assets.8-RUN npm install --global esbuild@0.25.12 html-minifier-terser@7.2.0 \9- && mkdir /out \9+RUN npm install --global esbuild@0.25.12 html-minifier-terser@7.2.010+11+# Tool installation is independent of the source, so ordinary web edits only12+# invalidate the small minification layer below.13+COPY web ./web14+RUN mkdir /out \1015 && cp -R web/. /out/ \1116 && esbuild web/app.js \1217 --format=esm \
@@ -27,13 +32,19 @@ RUN npm install --global esbuild@0.25.12 html-minifier-terser@7.2.0 \
2732 --use-short-doctype \2833 --output /out/index.html2934 30-# The control plane, built from source in one go.35+# The control plane. Web and documentation edits never enter this stage, while36+# registry and target caches keep Rust changes incremental across remote builds.3137 FROM rust:1.96-bookworm AS build3238 3339 WORKDIR /src34-COPY . .40+COPY Cargo.toml Cargo.lock ./41+COPY crates ./crates3542 36-RUN cargo build --release -p devsite-server43+RUN --mount=type=cache,id=devsite-cargo-registry,target=/usr/local/cargo/registry,sharing=locked \44+ --mount=type=cache,id=devsite-cargo-git,target=/usr/local/cargo/git,sharing=locked \45+ --mount=type=cache,id=devsite-cargo-target,target=/src/target,sharing=locked \46+ cargo build --release --locked -p devsite-server \47+ && install -Dm755 target/release/devsite-server /out/devsite-server3748 3849 FROM debian:bookworm-slim3950
@@ -42,7 +53,7 @@ RUN apt-get update \
4253 && apt-get install -y --no-install-recommends ca-certificates \4354 && rm -rf /var/lib/apt/lists/*4455 45-COPY --from=build /src/target/release/devsite-server /usr/local/bin/devsite-server56+COPY --from=build /out/devsite-server /usr/local/bin/devsite-server4657 COPY --from=web /out /app/web4758 4859 # Defaults for running in a container. Everything that differs per deployment —