FROM debian:bookworm

# Install dependencies
RUN apt-get update && apt-get install -y \
    build-essential \
    ca-certificates \
    curl \
    btop \
    cmake \
    gdb \
    gh \
    git \
    zsh \
    sudo \
    wget \
    libeigen3-dev \  
    libboost-all-dev \  
    binutils \  
    && rm -rf /var/lib/apt/lists/*

# Set up a non-root user with sudo
RUN useradd -ms /bin/zsh user && echo "user ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/user

USER user
WORKDIR /home/user/repos

# Install Oh My Zsh
RUN sh -c "$(wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)" "" --unattended

# Install zsh autosuggestions
RUN git clone https://github.com/zsh-users/zsh-autosuggestions ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-autosuggestions

# Install zsh syntax highlighting
RUN git clone https://github.com/zsh-users/zsh-syntax-highlighting.git ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/zsh-syntax-highlighting

# Configure zsh
RUN sed -i 's/plugins=(git)/plugins=(git zsh-autosuggestions zsh-syntax-highlighting)/' ~/.zshrc

# Install uv for managing Python and piqtree's dependencies
COPY --from=ghcr.io/astral-sh/uv:0.12.5 /uv /uvx /usr/local/bin/

# The workspace is mounted from the host, so copy rather than hardlink from the uv cache
ENV UV_LINK_MODE=copy

# Install Python 3.15 and expose its headers at a stable path for C++ IntelliSense
RUN uv python install 3.15 && \
    ln -s "$(dirname "$(dirname "$(uv python find 3.15)")")/include/python3.15" ~/.python-include

# Set up zsh as the default shell
SHELL ["/bin/zsh", "-c"]

# Set zsh as the default shell for the container
CMD [ "zsh" ]