Spaces:
Sleeping
Sleeping
| FROM ubuntu:22.04 | |
| ARG MODEL_REPO=Aldaris/Qwen3-4B-Q4_K_M-GGUF | |
| ARG MODEL_FILE=qwen3-4b-q4_k_m.gguf | |
| ENV DEBIAN_FRONTEND=noninteractive | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV PATH="/home/user/.local/bin:$PATH" | |
| WORKDIR /app | |
| COPY --chown=user . /app | |
| USER root | |
| RUN apt-get update && apt-get install -y \ | |
| git cmake build-essential g++ wget curl python3 python3-pip | |
| USER user | |
| RUN git clone https://github.com/ggerganov/llama.cpp.git | |
| WORKDIR /app/llama.cpp | |
| RUN cmake -B build -DBUILD_SHARED_LIBS=OFF -DGGML_CUDA=OFF | |
| RUN cmake --build build --config Release -j 4 | |
| WORKDIR /app/llama.cpp/build/bin | |
| # Descargar modelo GGUF directamente desde HuggingFace | |
| RUN wget -nv -O model.gguf \ | |
| "https://huggingface.co/${MODEL_REPO}/resolve/main/${MODEL_FILE}" | |
| # Exponer puerto 7860 (requerido por HF Spaces) | |
| EXPOSE 7860 | |
| CMD ["/app/llama.cpp/build/bin/llama-server", \ | |
| "--host", "0.0.0.0", \ | |
| "--port", "7860", \ | |
| "-m", "model.gguf", \ | |
| "-c", "4096", \ | |
| "--cache-type-k", "q8_0", \ | |
| "-ngl", "0"] |