FROM nvidia/cuda:12.1.0-devel-ubuntu22.04

LABEL description="Docker container for CUT3R with dependencies installed. CUDA VERSION"
ENV DEVICE="cuda"
ARG DEBIAN_FRONTEND=noninteractive


RUN apt-get update && \
    apt-get install -y --no-install-recommends \
    build-essential \
    cmake \
    curl \
    ffmpeg \
    git \
    wget \
    python3-pip \
    python3-dev \
    freeglut3-dev --fix-missing \
    unzip

RUN chsh -s /bin/bash
SHELL ["/bin/bash", "-c"]
ENV TORCH_CUDA_ARCH_LIST="7.5;8.0;8.6+PTX;8.9;9.0" 
RUN export FORCE_CUDA=1

RUN curl -LO https://repo.anaconda.com/miniconda/Miniconda3-py311_23.11.0-2-Linux-x86_64.sh
RUN bash Miniconda3-py311_23.11.0-2-Linux-x86_64.sh -p /miniconda -b
RUN rm Miniconda3-py311_23.11.0-2-Linux-x86_64.sh
ENV PATH=/miniconda/bin:${PATH}
RUN conda update -y conda
RUN conda init

RUN echo $PATH

RUN conda create -n cuter_env python=3.11 cmake=3.14.0 -y && \
    conda run -n cuter_env conda install pytorch torchvision pytorch-cuda=12.1 -c pytorch -c nvidia 

COPY ./CUT3R/requirements.txt /workspace/requirements.txt 
RUN conda run -n cuter_env pip install -r /workspace/requirements.txt


RUN conda run -n cuter_env conda install 'llvm-openmp<16'
RUN conda run -n cuter_env pip install git+https://github.com/nerfstudio-project/gsplat.git

RUN conda run -n cuter_env pip install \
    evo \
    open3d \
    wandb

ENV PYTHONPATH="${PYTHONPATH}:/workspace/cut3r"
ENV PYTHONPATH="${PYTHONPATH}:/workspace/cut3r/src"
