FROM nvidia/cuda:12.1.1-cudnn8-runtime-ubuntu22.04 ENV DEBIAN_FRONTEND=noninteractive \ PYTHONUNBUFFERED=1 \ PIP_NO_CACHE_DIR=1 \ HOME=/app \ HF_HOME=/app/.cache/huggingface \ XDG_CACHE_HOME=/app/.cache RUN apt-get update && apt-get install -y --no-install-recommends \ python3 python3-pip git && \ rm -rf /var/lib/apt/lists/* WORKDIR /app RUN mkdir -p /app/.cache/huggingface/transformers /app/.cache/huggingface/hub && chmod -R 777 /app/.cache COPY requirements.txt /app/ RUN python3 -m pip install --upgrade pip && pip install -r requirements.txt COPY app.py /app/ ENV HOST=0.0.0.0 EXPOSE 7860 CMD ["bash", "-lc", "uvicorn app:app --host 0.0.0.0 --port ${PORT:-7860}"]