FROM debian:12.7-slim

# Install required packages
RUN dpkg-reconfigure debconf --frontend=noninteractive && apt-get update && apt-get upgrade --yes && \
    apt-get install --yes --no-install-recommends \
    git \
    ssh \
    make \
    cmake \
    gcc \
    libc6-dev \
    curl \
    ca-certificates \
    gcc-arm-none-eabi \
    libnewlib-arm-none-eabi \
    qemu-system-arm \
    # remove for image size
    && rm -rf /var/lib/apt/lists/*

# Install Rustup and select the nightly toolchain
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --default-toolchain nightly && \
    . "$HOME/.cargo/env" && \
    rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu


# Add the Rust toolchain binaries to PATH
ENV PATH="/root/.cargo/bin:${PATH}"
