| FROM nvidia/cuda:12.8.0-cudnn-devel-ubuntu22.04 | |
| RUN apt update | |
| RUN apt install curl -y | |
| RUN apt-get update && \ | |
| apt-get upgrade -y && \ | |
| apt-get install -y git | |
| RUN apt install wget | |
| RUN wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/x86_64/cuda-keyring_1.1-1_all.deb | |
| RUN dpkg -i cuda-keyring_1.1-1_all.deb | |
| RUN apt-get update | |
| RUN apt-get -y install cuda-toolkit-12-8 -y | |
| ENV version="10.8.0.43-1+cuda12.8" | |
| RUN apt-get install libnvinfer-bin=${version} libnvinfer-dev=${version} libnvinfer-dispatch-dev=${version} libnvinfer-dispatch10=${version} libnvinfer-headers-dev=${version} libnvinfer-headers-plugin-dev=${version} libnvinfer-lean-dev=${version} libnvinfer-lean10=${version} libnvinfer-plugin-dev=${version} libnvinfer-plugin10=${version} libnvinfer-samples=${version} libnvinfer-vc-plugin-dev=${version} libnvinfer-vc-plugin10=${version} libnvinfer10=${version} libnvonnxparsers-dev=${version} libnvonnxparsers10=${version} python3-libnvinfer-dev=${version} python3-libnvinfer-dispatch=${version} python3-libnvinfer-lean=${version} python3-libnvinfer=${version} tensorrt-dev=${version} tensorrt-libs=${version} tensorrt=${version} -y | |
| RUN apt-mark hold libnvinfer-bin libnvinfer-dev libnvinfer-dispatch-dev libnvinfer-dispatch10 libnvinfer-headers-dev libnvinfer-headers-plugin-dev libnvinfer-lean-dev libnvinfer-lean10 libnvinfer-plugin-dev libnvinfer-plugin10 libnvinfer-samples libnvinfer-vc-plugin-dev libnvinfer-vc-plugin10 libnvinfer10 libnvonnxparsers-dev libnvonnxparsers10 python3-libnvinfer-dev python3-libnvinfer-dispatch python3-libnvinfer-lean python3-libnvinfer tensorrt-dev tensorrt-libs tensorrt | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| RUN curl -LsSf https://astral.sh/uv/install.sh | sh | |
| RUN uv venv venv --python=3.11 | |
| COPY --chown=user ./requirements.txt requirements.txt | |
| COPY --chown=user . /app | |
| RUN /bin/bash -c "source venv/bin/activate && uv pip install --no-cache-dir --upgrade -r requirements.txt" | |
| ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib/x86_64-linux-gnu | |
| CMD ["/app/venv/bin/python", "-m", "uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] |