FROM pytorch/pytorch:2.7.1-cuda12.6-cudnn9-devel

RUN apt-get update -y && apt-get install -y --no-install-recommends \
    tmux \
    nano \
    htop \
    wget \
    curl \
    git \
    libsm6 \        
    libxrender1 \  
    libfontconfig1 \ 
    ffmpeg \
    libxext6 \
    openssh-server \
    cmake \
    libncurses5-dev \
    libncursesw5-dev \
    build-essential

RUN echo 'PermitRootLogin yes\nSubsystem sftp internal-sftp\nX11Forwarding yes\nX11UseLocalhost no\nAllowTcpForwarding yes' > /etc/ssh/sshd_config
EXPOSE 22
RUN groupadd sshgroup
RUN mkdir /var/run/sshd
RUN mkdir -p /root/.ssh && \
    chmod 0700 /root/.ssh

# ADD YOUR PUBLIC KEY HERE 
# COPY cm-docker.pub /root/.ssh
# RUN cat /root/.ssh/cm-docker.pub >> /root/.ssh/authorized_keys

# REPLACE rootpassword WITH YOUR PASSWORD
RUN echo 'root:rootpassword' | chpasswd

# Force bash color prompt
RUN sed -i 's/#force_color_prompt=yes/force_color_prompt=yes/g' ~/.bashrc

RUN git clone https://github.com/Syllo/nvtop.git -b 3.0.1 ~/nvtop
RUN mkdir -p ~/nvtop/build
RUN cd ~/nvtop/build && cmake .. -DNVIDIA_SUPPORT=ON -DAMDGPU_SUPPORT=OFF -DINTEL_SUPPORT=OFF
RUN cd ~/nvtop/build && make
RUN cd ~/nvtop/build && make install

COPY requirements.txt /workspace
RUN pip install --upgrade pip
RUN pip install -r /workspace/requirements.txt

CMD ["/bin/bash"]
