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


RUN 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/cu117

RUN pip3 install onnxruntime onnx

WORKDIR /workspace

RUN mkdir -p /workspace/models

COPY ./dag.pickle /workspace/dag.pickle

COPY ./server_config.json /workspace/server_config.json

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

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