Spaces:
Paused
Paused
Download Dockerfile from SamilG2/BACKEND-CheckScan: direct link, hf CLI and curl.
- Browser
- Download file 2.35 kB
-
https://huggingface.co/spaces/SamilG2/BACKEND-CheckScan/resolve/main/Dockerfile
- Command line
-
hf download hf://spaces/SamilG2/BACKEND-CheckScan/Dockerfile
-
curl -L -o Dockerfile https://huggingface.co/spaces/SamilG2/BACKEND-CheckScan/resolve/main/Dockerfile
2.35 kB
| # Imagen base CUDA 12.1 *runtime*: trae las libs CUDA para que el wheel | |
| # precompilado de llama-cpp-python offloadee a la T4. NO compilamos (compilar | |
| # en el builder de HF muere por OOM); usamos wheel ya hecho del indice cu121. | |
| FROM nvidia/cuda:12.1.1-runtime-ubuntu22.04 | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| # Python + Stockfish + libs de OpenCV (sin toolchain: no compilamos nada) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| python3 python3-pip \ | |
| stockfish \ | |
| libgl1 libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Requirements primero para aprovechar layer cache | |
| COPY requirements.txt . | |
| # numpy ANTES que torch (evita downgrade implícito) | |
| RUN pip3 install --no-cache-dir --upgrade pip \ | |
| && pip3 install --no-cache-dir numpy==1.26.0 | |
| # torch con CUDA 12.1 | |
| RUN pip3 install --no-cache-dir torch torchvision \ | |
| --index-url https://download.pytorch.org/whl/cu121 | |
| # llama-cpp-python: SOLO wheel precompilado con CUDA (--only-binary). Sin fijar | |
| # version → toma la más nueva que tenga wheel cu121 para py3.10. Si no hay wheel, | |
| # falla en SEGUNDOS (no intenta compilar 25 min). La API que usa qwen.py es estable. | |
| RUN pip3 install --no-cache-dir --only-binary llama-cpp-python \ | |
| llama-cpp-python \ | |
| --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cu121 | |
| # Resto de dependencias de la app | |
| RUN pip3 install --no-cache-dir -r requirements.txt | |
| # Pre-descarga del coach (LoRA fine-tuned, GGUF) en build → arranque rápido en | |
| # runtime. Repo público en HF Hub; ajústalo con --build-arg si cambias el nombre. | |
| ARG QWEN_COACH_REPO=SamilG2/qwen-coach-checkscan | |
| ARG QWEN_COACH_FILENAME=qwen-coach-q4_k_m.gguf | |
| RUN mkdir -p /app/models && \ | |
| QWEN_COACH_REPO="$QWEN_COACH_REPO" QWEN_COACH_FILENAME="$QWEN_COACH_FILENAME" \ | |
| python3 -c "from huggingface_hub import hf_hub_download; import os; hf_hub_download(repo_id=os.environ['QWEN_COACH_REPO'], filename=os.environ['QWEN_COACH_FILENAME'], local_dir='/app/models')" | |
| # Código de la app | |
| COPY . /app | |
| ENV STOCKFISH_PATH=/usr/games/stockfish \ | |
| QWEN_MODEL_PATH=/app/models/qwen-coach-q4_k_m.gguf \ | |
| COACH_MODEL=qwen \ | |
| STOCKFISH_THREADS=4 \ | |
| STOCKFISH_HASH_MB=256 \ | |
| PYTHONUNBUFFERED=1 | |
| EXPOSE 7860 | |
| CMD ["gunicorn", "-w", "1", "-b", "0.0.0.0:7860", "--timeout", "600", "app:app"] | |