FROM python:3.11-slim AS base RUN apt-get update \ && apt-get install -y --no-install-recommends \ libgl1 \ libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* RUN useradd -m -u 1000 user WORKDIR /app FROM base AS deps RUN pip install --no-cache-dir \ torch==2.3.0+cpu \ torchvision==0.18.0+cpu \ --index-url https://download.pytorch.org/whl/cpu COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt FROM deps AS runtime COPY --chown=user:user . . RUN mkdir -p /app/checkpoints USER user EXPOSE 7860 CMD ["uvicorn", "app.main:app", \ "--host", "0.0.0.0", \ "--port", "7860", \ "--workers", "1", \ "--log-level", "info"]