# Drop the pre-built NVIDIA container in favor of a clean, standardized Python base FROM python:3.10-slim # Install git, compiler tools, and clean up apt indexes to keep image slim RUN apt-get update && apt-get install -y \ git \ build-essential \ && rm -rf /var/lib/apt/lists/* ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ PYTHONUNBUFFERED=1 RUN useradd -m -u 1000 user WORKDIR $HOME/app # Initialize the internal queue tracking DB file RUN touch generation_cache_queue.db && chown user:user generation_cache_queue.db COPY --chown=user requirements.txt $HOME/app/requirements.txt RUN chown -R user:user $HOME/app USER user # Install matched stable PyTorch + CUDA binaries along with your dependencies RUN pip install --no-cache-dir --upgrade pip && \ pip install --no-cache-dir torch==2.4.0 torchvision==0.19.0 --index-url https://download.pytorch.org/whl/cu121 && \ pip install --no-cache-dir -r requirements.txt COPY --chown=user . $HOME/app EXPOSE 7860 CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]