MABELab-RS/Dockerfile.dev

36 lines
1.4 KiB
Docker

# Developer image: Rust + build tools + sccache + minimal deps
FROM rust:1-bookworm
# Install useful build deps and tooling
RUN apt-get update && apt-get install -y --no-install-recommends \
clang cmake pkg-config libssl-dev git ca-certificates curl \
&& rm -rf /var/lib/apt/lists/*
# sccache speeds up incremental builds across container runs
ENV SCCACHE_DIR=/root/.cache/sccache
RUN cargo install sccache
# Configure rustc to use sccache by default
ENV RUSTC_WRAPPER=/usr/local/cargo/bin/sccache
ENV CARGO_INCREMENTAL=0
# Optional: set a default toolchain (can be overridden by rust-toolchain.toml)
RUN rustup component add clippy rustfmt
# Create a non-root user (optional; comment out if you prefer root)
RUN useradd -m -u 1000 dev
USER dev
WORKDIR /work
# Cache hints: create empty project files so first build primes caches
COPY --chown=dev:dev Cargo.toml ./
COPY --chown=dev:dev crates/mabelabrs-core/Cargo.toml crates/mabelabrs-core/Cargo.toml
COPY --chown=dev:dev crates/mabelabrs-world/Cargo.toml crates/mabelabrs-world/Cargo.toml
COPY --chown=dev:dev crates/mabelabrs-eval/Cargo.toml crates/mabelabrs-eval/Cargo.toml
COPY --chown=dev:dev crates/mabelabrs-io/Cargo.toml crates/mabelabrs-io/Cargo.toml
COPY --chown=dev:dev crates/mabelabrs-utils/Cargo.toml crates/mabelabrs-utils/Cargo.toml
COPY --chown=dev:dev crates/mabelabrs-ffi/Cargo.toml crates/mabelabrs-ffi/Cargo.toml
# Final copy happens at runtime via bind mount; this stage just primes caches.