Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 18 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ndarray — Railway compile-test image (AVX2 default)
# Verifies the HPC module builds cleanly (default + jit-native features)
# Requires Rust 1.94.0 (LazyLock, simd_caps, modern std APIs)
# Requires Rust 1.95.0 (LazyLock, simd_caps, modern std APIs)
#
# CPU detection & SIMD dispatch documentation: see Dockerfile.md
# AVX-512 pinned variant: see Dockerfile.avx512
Expand All @@ -15,13 +15,17 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
curl ca-certificates gcc libc6-dev pkg-config libssl-dev \
&& rm -rf /var/lib/apt/lists/*

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

WORKDIR /app

Expand All @@ -30,6 +34,15 @@ COPY Cargo.toml Cargo.lock ./
COPY ndarray-rand/Cargo.toml ndarray-rand/Cargo.toml
COPY crates/ crates/

# The root Cargo.toml has `[patch.crates-io] chacha20 = { path = "vendor/chacha20" }`.
# Cargo resolves patch entries while LOADING THE MANIFEST — before features, before
# targets, on every command — so without this the build dies at parse with
# "failed to load source for dependency `chacha20` / unable to update
# /app/vendor/chacha20". Same class as the examples/benches note below, and the
# reason a selective-COPY Dockerfile has to be updated whenever a path source is
# added to the manifest.
COPY vendor/ vendor/

# Copy source
COPY src/ src/
COPY ndarray-rand/src/ ndarray-rand/src/
Expand Down Expand Up @@ -63,4 +76,4 @@ RUN cargo test --release --lib -- hpc:: 2>&1 && echo "=== HPC TESTS OK ==="
# Minimal runtime image — just proves it compiled
FROM debian:bookworm-slim
COPY --from=builder /app/target/release/libndarray.rlib /usr/local/lib/
CMD ["echo", "ndarray build verified — Rust 1.94.0"]
CMD ["echo", "ndarray build verified — Rust 1.95.0"]
12 changes: 9 additions & 3 deletions Dockerfile.avx512
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,20 @@ ENV RUSTUP_HOME=/usr/local/rustup \
CARGO_HOME=/usr/local/cargo \
PATH=/usr/local/cargo/bin:$PATH
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | \
sh -s -- -y --default-toolchain 1.94.0 --profile minimal \
&& rustc --version | grep -q "1.94.0"
sh -s -- -y --default-toolchain 1.95.0 --profile minimal \
&& rustc --version | grep -q "1.95.0"

WORKDIR /app

COPY Cargo.toml Cargo.lock ./
COPY ndarray-rand/Cargo.toml ndarray-rand/Cargo.toml
COPY crates/ crates/

# `[patch.crates-io] chacha20 = { path = "vendor/chacha20" }` in the root
# manifest. Cargo resolves patch entries at MANIFEST LOAD, so omitting this
# fails the build at parse, not at link. See the same note in ./Dockerfile.
COPY vendor/ vendor/

COPY src/ src/
COPY ndarray-rand/src/ ndarray-rand/src/

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

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