# Linux x86_64 CPU-only test image for the Rust port crates that are gated on
# cfg(target_os = "linux", target_arch = "x86_64") and cannot run on macOS.
# No sources, caches or build products are baked in; run.sh mounts them.
#
# Build via scripts/linux-tests/run.sh (it passes RUST_VERSION from
# rust-toolchain.toml). Runs under Rosetta/qemu on Apple Silicon.
ARG RUST_VERSION
# Always built with `--platform linux/amd64` by run.sh.
FROM rust:${RUST_VERSION}-bookworm

RUN apt-get update \
 && apt-get install -y --no-install-recommends build-essential clang pkg-config python3 \
 && rm -rf /var/lib/apt/lists/*

# The official image already carries this exact toolchain; pin it explicitly so
# rustup never tries to fetch the rustfmt/clippy components named in
# rust-toolchain.toml (they are not needed for tests).
ARG RUST_VERSION
ENV RUSTUP_TOOLCHAIN=${RUST_VERSION}-x86_64-unknown-linux-gnu \
    CARGO_HOME=/cargo-cache \
    CARGO_TARGET_DIR=/target \
    CARGO_TERM_COLOR=never \
    CARGO_INCREMENTAL=0 \
    RUST_BACKTRACE=0
WORKDIR /src
