FROM nvcr.io/nvidia/tritonserver:21.10-py3

RUN apt-key adv --fetch-keys \
    https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/3bf863cc.pub && \
    apt-get update                                && \
    apt-get install -y software-properties-common && \
    add-apt-repository ppa:deadsnakes/ppa         && \
    apt-get update                                && \
    apt-get install -y         \
              zip              \
              wget             \
              unzip            \
              python3.8        \
              python3-pip      \
              libgl1-mesa-glx

RUN pip3 install -U pip

RUN pip3 install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113

RUN pip3 install pyarrow onnxruntime

RUN pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple towhee --pre
RUN pip install -i https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple towhee.models --pre

RUN apt-get install git-lfs && \
    git lfs install

WORKDIR /workspace

RUN git clone -b nebullvm https://github.com/towhee-io/towhee-compiler.git
RUN cd towhee-compiler && pip install -r requirements.txt &&  python3 setup.py develop
RUN python3 -c "import nebullvm"

RUN mkdir -p /workspace/models

COPY ./dag.json /workspace/dag.json

RUN triton_builder /workspace/dag.json /workspace/models
 
