1adaodoze commited on
Commit
2657786
·
verified ·
1 Parent(s): 28d21d5

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +12 -8
Dockerfile CHANGED
@@ -1,27 +1,31 @@
1
- # Use Python 3.10, compatível com o wheel específico do HF Spaces
2
  FROM python:3.10-slim
3
 
4
  WORKDIR /app
5
 
6
- # 1. Instala as dependências de sistema necessárias
7
  RUN apt-get update && apt-get install -y \
8
  gcc g++ make cmake git libopenblas-dev \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
- # 2. Instala o llama-cpp-python a partir do wheel DEFINITIVO para HF Spaces (Luigi)
12
- RUN pip install --no-cache-dir --root-user-action=ignore \
13
- https://huggingface.co/Luigi/llama-cpp-python-wheels-hf-spaces-free-cpu/resolve/main/llama_cpp_python-0.3.22-cp310-cp310-linux_x86_64.whl
14
 
15
- # 3. Instala as demais dependências
 
 
 
16
  COPY requirements.txt .
17
  RUN pip install --no-cache-dir --root-user-action=ignore -r requirements.txt
18
 
19
- # 4. Copia o código
20
  COPY . .
21
 
22
- # 5. Configurações
23
  ENV PYTHONUNBUFFERED=1
24
  ENV GRADIO_SERVER_NAME=0.0.0.0
25
  EXPOSE 7860
26
 
 
27
  CMD ["python", "app.py"]
 
1
+ # Use Python 3.10, compatível com o ambiente do HF Spaces
2
  FROM python:3.10-slim
3
 
4
  WORKDIR /app
5
 
6
+ # 1. Instala as dependências de sistema necessárias para a compilação
7
  RUN apt-get update && apt-get install -y \
8
  gcc g++ make cmake git libopenblas-dev \
9
  && rm -rf /var/lib/apt/lists/*
10
 
11
+ # 2. Otimiza a compilação para rodar mais rápido e evitar timeout
12
+ ENV CMAKE_BUILD_PARALLEL_LEVEL=2
13
+ ENV CMAKE_ARGS="-DLLAMA_BUILD_TESTS=OFF -DLLAMA_BUILD_EXAMPLES=OFF -DLLAMA_BUILD_SERVER=OFF -DGGML_NATIVE=OFF"
14
 
15
+ # 3. Compila o llama-cpp-python do código-fonte (garante 100% de compatibilidade)
16
+ RUN pip install --no-cache-dir --root-user-action=ignore llama-cpp-python==0.3.16
17
+
18
+ # 4. Instala as demais dependências do requirements.txt
19
  COPY requirements.txt .
20
  RUN pip install --no-cache-dir --root-user-action=ignore -r requirements.txt
21
 
22
+ # 5. Copia o código da aplicação
23
  COPY . .
24
 
25
+ # 6. Configurações do Gradio
26
  ENV PYTHONUNBUFFERED=1
27
  ENV GRADIO_SERVER_NAME=0.0.0.0
28
  EXPOSE 7860
29
 
30
+ # 7. Comando para iniciar o app
31
  CMD ["python", "app.py"]