FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV HF_HOME=/cache/huggingface ENV HF_HUB_CACH=/cache/huggingface/hub ENV TOKENIZERS_PARALLELISM=false RUN apt-get update && apt-get install -y --no-install-recommends \ python3 \ python3-pip \ curl \ libglib2.0-0 \ libsm6 \ libxrender1 \ libxext6 \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* RUN ln -s /usr/bin/python3 /usr/bin/python WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir --upgrade pip setuptools wheel RUN pip install --no-cache-dir \ torch==2.3.1 \ torchvision==0.18.1 \ torchaudio==2.3.1 \ --index-url https://download.pytorch.org/whl/cu121 RUN pip install --no-cache-dir -r requirements.txt COPY . . EXPOSE 7860 HEALTHCHECK --interval=30s --timeout=10s --start-period=300s --retries=3 \ CMD curl -f http://localhost:8000/ready || exit 1 CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]