Juanoto2012 commited on
Commit
0a7ca9e
verified
1 Parent(s): 9167576

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +9 -7
Dockerfile CHANGED
@@ -1,7 +1,7 @@
1
  # Usamos una imagen de Python ligera y estable
2
  FROM python:3.10-slim
3
 
4
- # 1. Instalar herramientas de compilaci贸n (requerido para instalar llama-cpp-python)
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
  gcc \
@@ -15,16 +15,18 @@ ENV HOME=/home/user \
15
  PATH=/home/user/.local/bin:$PATH
16
  WORKDIR $HOME/app
17
 
18
- # 3. Copiar el archivo de dependencias e instalarlas
19
  COPY --chown=user requirements.txt .
20
- # Usamos --prefer-binary para acelerar la instalaci贸n si hay wheels disponibles
 
 
 
 
21
  RUN pip install --no-cache-dir --prefer-binary -r requirements.txt
22
 
23
- # 4. Copiar el resto de tu c贸digo (tu app.py)
24
  COPY --chown=user . .
25
 
26
- # 5. Hugging Face Spaces enruta el tr谩fico al puerto 7860 por defecto
27
  EXPOSE 7860
28
-
29
- # 6. Iniciar la aplicaci贸n usando Uvicorn (optimizando workers)
30
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  # Usamos una imagen de Python ligera y estable
2
  FROM python:3.10-slim
3
 
4
+ # 1. Instalar herramientas base
5
  RUN apt-get update && apt-get install -y \
6
  build-essential \
7
  gcc \
 
15
  PATH=/home/user/.local/bin:$PATH
16
  WORKDIR $HOME/app
17
 
18
+ # 3. Copiar dependencias
19
  COPY --chown=user requirements.txt .
20
+
21
+ # 4. TRUCO ANTI-TIMEOUT: Instalar llama-cpp-python pre-compilado para CPU
22
+ RUN pip install --no-cache-dir llama-cpp-python --extra-index-url https://abetlen.github.io/llama-cpp-python/whl/cpu
23
+
24
+ # 5. Instalar el resto de dependencias r谩pidamente
25
  RUN pip install --no-cache-dir --prefer-binary -r requirements.txt
26
 
27
+ # 6. Copiar el resto de tu c贸digo
28
  COPY --chown=user . .
29
 
30
+ # 7. Exponer puerto y arrancar Uvicorn
31
  EXPOSE 7860
 
 
32
  CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]