golemet commited on
Commit
3b2a699
·
verified ·
1 Parent(s): c71f8d7

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +23 -10
Dockerfile CHANGED
@@ -1,18 +1,31 @@
1
- # Usar imagen oficial de Python
2
- FROM python:3.11-slim
3
 
4
- # Establecer directorio de trabajo
 
 
 
 
 
 
 
 
 
 
 
5
  WORKDIR /app
6
 
7
- # Copiar archivos de la app
8
- COPY . /app
9
 
10
- # Instalar dependencias
11
- RUN pip install --upgrade pip
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
- # Exponer puerto que usará FastAPI
 
 
 
15
  EXPOSE 7860
16
 
17
- # Comando para ejecutar FastAPI usando uvicorn
18
- CMD ["uvicorn", "nut:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Imagen base ligera y estable con Python 3.10
2
+ FROM python:3.10-slim
3
 
4
+ # Evitar que Python genere archivos .pyc
5
+ ENV PYTHONDONTWRITEBYTECODE=1
6
+ ENV PYTHONUNBUFFERED=1
7
+
8
+ # Instalar dependencias del sistema necesarias para transformers y torch
9
+ RUN apt-get update && apt-get install -y \
10
+ gcc \
11
+ g++ \
12
+ git \
13
+ && rm -rf /var/lib/apt/lists/*
14
+
15
+ # Crear el directorio de la app
16
  WORKDIR /app
17
 
18
+ # Copiar requirements
19
+ COPY requirements.txt .
20
 
21
+ # Instalar las dependencias
 
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
+ # Copiar el código
25
+ COPY . .
26
+
27
+ # Exponer el puerto (FastAPI por HuggingFace normalmente usa 7860)
28
  EXPOSE 7860
29
 
30
+ # Comando de ejecución
31
+ CMD ["uvicorn", "nu:app", "--host", "0.0.0.0", "--port", "7860"]