Server Dockerfile: CARGO_BUILD_JOBS build arg for the Pi runner

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01TQd3pEP9UeN2uifbHknQ7B
This commit is contained in:
2026-10-18 21:50:19 +02:00
parent a59abebc49
commit b4d9467389
+7 -1
View File
@@ -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/