FROM --platform=linux/amd64 python:3.10

WORKDIR /code

# Install base utilities
RUN apt-get update \
    && apt-get install -y build-essential \
    && apt-get install -y wget libsnappy-dev \
    && apt-get clean \
    && rm -rf /var/lib/apt/lists/*

# Install miniconda
ENV CONDA_DIR /opt/conda
RUN wget --quiet https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O ~/miniconda.sh && \
    /bin/bash ~/miniconda.sh -b -p /opt/conda

# Put conda in path so we can use conda activate
ENV PATH=$CONDA_DIR/bin:$PATH

RUN conda install --yes pytorch torchvision torchaudio pytorch-cuda=12.1 -c pytorch -c nvidia

COPY . .

RUN git clone https://github.com/TRI-ML/vlm-evaluation.git

RUN cd vlm-evaluation && pip install -e .

RUN pip install -e .


RUN echo "HF_HOME (before setting it)= $HF_HOME "

ENV HF_HOME=/data/.huggingface
RUN mkfir /logs

CMD ["sh", "/code/startup.sh"]