FROM python:3.12-slim RUN apt-get update && apt-get install -y --no-install-recommends build-essential cmake libgomp1 && rm -rf /var/lib/apt/lists/* COPY space/requirements.txt /tmp/requirements.txt ENV CMAKE_ARGS="-DGGML_NATIVE=OFF" CMAKE_BUILD_PARALLEL_LEVEL=2 RUN pip install --no-cache-dir torch==2.10.0 --index-url https://download.pytorch.org/whl/cpu RUN pip install --no-cache-dir -r /tmp/requirements.txt RUN useradd -m -u 1000 app WORKDIR /home/app/app COPY --chown=app:app . . USER app ENV HF_HOME=/home/app/.cache/huggingface PYTHONUNBUFFERED=1 GRADIO_ANALYTICS_ENABLED=False RUN python -m space.download_models EXPOSE 7860 CMD ["python", "-m", "space.app"]