From b4d9467389c1d2a8331fc1e33809d1296c733a3f Mon Sep 17 00:00:00 2001 From: Jacob Hagstedt Date: Sun, 18 Oct 2026 21:50:19 +0200 Subject: [PATCH] Server Dockerfile: CARGO_BUILD_JOBS build arg for the Pi runner Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B --- server/Dockerfile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/server/Dockerfile b/server/Dockerfile index b40a5b4..9fbd0b7 100644 --- a/server/Dockerfile +++ b/server/Dockerfile @@ -6,6 +6,10 @@ # ---- stage 1: build -------------------------------------------------------------------------------------------- FROM docker.io/library/rust:1.99.1-bookworm AS build ARG TARGETARCH +# Parallel rustc jobs. Unset (the default) means cargo's own default, one per core, as on the Mac. The Gitea runner +# on the Pi 3 (1 GB RAM) passes --build-arg CARGO_BUILD_JOBS=1. Passed as an explicit --jobs flag, only when set, +# so an empty value never reaches cargo. +ARG CARGO_BUILD_JOBS # The full bookworm image carries gcc 12 and make, which aws-lc-sys (rustls via reqwest, jsonwebtoken) needs to # compile its C code; no cmake binary is needed (checked 2026-10-18, docs/spikes/pi-image-arm64.md). # Use the image's toolchain as is; rust-toolchain.toml names the same version but would also pull clippy/rustfmt. @@ -22,7 +26,9 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \ amd64) triple=x86_64-unknown-linux-gnu ;; \ *) echo "unsupported TARGETARCH ${TARGETARCH}" >&2; exit 1 ;; \ esac \ - && cargo build --release --locked --target "$triple" -p kvitt-server -p kvitt-import \ + && echo "cargo build jobs: ${CARGO_BUILD_JOBS:-default (one per core)}" \ + && cargo build --release --locked --target "$triple" ${CARGO_BUILD_JOBS:+--jobs $CARGO_BUILD_JOBS} \ + -p kvitt-server -p kvitt-import \ && mkdir -p /out \ && cp "target/$triple/release/kvitt-server" "target/$triple/release/kvitt-import" /out/