FROM debian:bullseye-slim
RUN useradd --uid 5000 --create-home --shell /bin/bash dev

RUN apt-get update \
    && apt-get install -y \
        linux-perf \
        linux-base \
        ca-certificates \
        wget \
        build-essential \
        git \
        --no-install-recommends \
    && rm -rf /var/lib/apt/lists/*

USER dev
WORKDIR "/home/dev"

RUN wget https://sh.rustup.rs -O rustup.sh \
    && sha256sum rustup.sh \
    && echo "9a165af7c7446f07a978c6ab618dc5080bfe918b2bc88e9ad0f6df985b4e4dcb  rustup.sh" | sha256sum -c - \
    && sh rustup.sh --default-toolchain none -y \
    && rm rustup.sh \
    && /home/dev/.cargo/bin/rustup default nightly \
    && mv /home/dev/.cargo /home/dev/cargo

ENV PATH=${PATH}:/home/dev/cargo/bin

ENTRYPOINT [ "/bin/bash" ]
