Skip to content

Commit 7988da6

Browse files
committed
Docker: copy vendor/ and pin rustc 1.95.0
Two bugs, both pre-existing, the second hidden behind the first. 1. vendor/ was never copied The root manifest has `[patch.crates-io] chacha20 = { path = "vendor/chacha20" }`, and both Dockerfiles do a selective COPY -- Cargo.toml, crates/, src/, examples/, benches/ -- that never included vendor/. Cargo resolves patch entries while LOADING THE MANIFEST, before features and before target selection, so this is not a link-time miss; the build dies at parse: error: failed to load source for dependency `chacha20` Caused by: Unable to update /app/vendor/chacha20 Caused by: failed to read `/app/vendor/chacha20/Cargo.toml` vendor/chacha20 is tracked (18 files) and not gitignored, and .dockerignore does not exclude vendor/ -- the directory simply was never listed. The patch arrived in 2539cad without the Dockerfiles being updated alongside it. Same failure class as the examples/benches note already in the file, which exists because this happened once before. 2. The image pinned rustc 1.94.0 for a crate that requires 1.95 Cargo.toml says `rust-version = "1.95"` and rust-toolchain.toml says channel = "1.95.0", but the Dockerfiles installed 1.94.0 and asserted it. This would have been the very next failure after fixing (1) and was invisible until then. rust-toolchain.toml is deliberately not copied into the image -- rustup would fetch a second toolchain at build time -- so the Dockerfile pin is the only thing keeping the image in step with the repo, and there is now a comment saying so and telling the next person to bump it when the toolchain moves. Verified by reproducing the Docker context exactly (no daemon available): a directory populated with precisely the Dockerfile's COPY list. before, old COPY set: cargo metadata -> exit 101, the identical error after, with vendor/: cargo metadata -> exit 0 then all three of the Dockerfile's RUN steps, on 1.95.0, with the image's RUSTFLAGS="-C target-cpu=x86-64-v3": cargo build --release Finished, 43.21s cargo build --release --features jit-native Finished, 45.99s cargo test --release --lib -- hpc:: 1732 passed, 0 failed Not verified: an actual `docker build`. No daemon in this environment. The simulation reproduces the reported failure byte-for-byte and clears it, and it exercises every RUN line, but it does not cover anything specific to the debian base image or the apt layer. Claude-Session: https://claude.ai/code/session_01VdfbkUCBbtZhy3yjSfCDHp
1 parent 6b5ca21 commit 7988da6

2 files changed

Lines changed: 27 additions & 8 deletions

File tree

‎Dockerfile‎

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# ndarray — Railway compile-test image (AVX2 default)
22
# Verifies the HPC module builds cleanly (default + jit-native features)
3-
# Requires Rust 1.94.0 (LazyLock, simd_caps, modern std APIs)
3+
# Requires Rust 1.95.0 (LazyLock, simd_caps, modern std APIs)
44
#
55
# CPU detection & SIMD dispatch documentation: see Dockerfile.md
66
# AVX-512 pinned variant: see Dockerfile.avx512
@@ -15,13 +15,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
1515
curl ca-certificates gcc libc6-dev pkg-config libssl-dev \
1616
&& rm -rf /var/lib/apt/lists/*
1717

18-
# Install Rust 1.94.0 via rustup
18+
# Install Rust 1.95.0 via rustup — MUST match rust-toolchain.toml (channel =
19+
# "1.95.0") and Cargo.toml's `rust-version = "1.95"`. rust-toolchain.toml is
20+
# deliberately NOT copied into the image (rustup would try to download a second
21+
# toolchain at build time), so this pin is the only thing keeping the image in
22+
# step with the repo — bump it whenever rust-toolchain.toml moves.
1923
ENV RUSTUP_HOME=/usr/local/rustup \
2024
CARGO_HOME=/usr/local/cargo \
2125
PATH=/usr/local/cargo/bin:$PATH
2226
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
23-
sh -s -- -y --default-toolchain 1.94.0 --profile minimal \
24-
&& rustc --version | grep -q "1.94.0"
27+
sh -s -- -y --default-toolchain 1.95.0 --profile minimal \
28+
&& rustc --version | grep -q "1.95.0"
2529

2630
WORKDIR /app
2731

@@ -30,6 +34,15 @@ COPY Cargo.toml Cargo.lock ./
3034
COPY ndarray-rand/Cargo.toml ndarray-rand/Cargo.toml
3135
COPY crates/ crates/
3236

37+
# The root Cargo.toml has `[patch.crates-io] chacha20 = { path = "vendor/chacha20" }`.
38+
# Cargo resolves patch entries while LOADING THE MANIFEST — before features, before
39+
# targets, on every command — so without this the build dies at parse with
40+
# "failed to load source for dependency `chacha20` / unable to update
41+
# /app/vendor/chacha20". Same class as the examples/benches note below, and the
42+
# reason a selective-COPY Dockerfile has to be updated whenever a path source is
43+
# added to the manifest.
44+
COPY vendor/ vendor/
45+
3346
# Copy source
3447
COPY src/ src/
3548
COPY ndarray-rand/src/ ndarray-rand/src/
@@ -63,4 +76,4 @@ RUN cargo test --release --lib -- hpc:: 2>&1 && echo "=== HPC TESTS OK ==="
6376
# Minimal runtime image — just proves it compiled
6477
FROM debian:bookworm-slim
6578
COPY --from=builder /app/target/release/libndarray.rlib /usr/local/lib/
66-
CMD ["echo", "ndarray build verified — Rust 1.94.0"]
79+
CMD ["echo", "ndarray build verified — Rust 1.95.0"]

‎Dockerfile.avx512‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,20 @@ ENV RUSTUP_HOME=/usr/local/rustup \
2121
CARGO_HOME=/usr/local/cargo \
2222
PATH=/usr/local/cargo/bin:$PATH
2323
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
24-
sh -s -- -y --default-toolchain 1.94.0 --profile minimal \
25-
&& rustc --version | grep -q "1.94.0"
24+
sh -s -- -y --default-toolchain 1.95.0 --profile minimal \
25+
&& rustc --version | grep -q "1.95.0"
2626

2727
WORKDIR /app
2828

2929
COPY Cargo.toml Cargo.lock ./
3030
COPY ndarray-rand/Cargo.toml ndarray-rand/Cargo.toml
3131
COPY crates/ crates/
32+
33+
# `[patch.crates-io] chacha20 = { path = "vendor/chacha20" }` in the root
34+
# manifest. Cargo resolves patch entries at MANIFEST LOAD, so omitting this
35+
# fails the build at parse, not at link. See the same note in ./Dockerfile.
36+
COPY vendor/ vendor/
37+
3238
COPY src/ src/
3339
COPY ndarray-rand/src/ ndarray-rand/src/
3440

@@ -51,4 +57,4 @@ RUN cargo test --release --lib -- hpc:: 2>&1 && echo "=== AVX-512 HPC TESTS OK =
5157

5258
FROM debian:bookworm-slim
5359
COPY --from=builder /app/target/release/libndarray.rlib /usr/local/lib/
54-
CMD ["echo", "ndarray AVX-512 build verified — Rust 1.94.0, target-cpu=x86-64-v4"]
60+
CMD ["echo", "ndarray AVX-512 build verified — Rust 1.95.0, target-cpu=x86-64-v4"]

0 commit comments

Comments
 (0)