File size: 1,020 Bytes
4f738c2
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
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"]