julianzrmrz commited on
Commit
8df9e1d
verified
1 Parent(s): 176433f

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -14
Dockerfile CHANGED
@@ -1,8 +1,9 @@
 
1
  FROM python:3.10-slim
2
 
3
  WORKDIR /app
4
 
5
- # 1. Instalar dependencias del sistema (Linux)
6
  RUN apt-get update && apt-get install -y \
7
  build-essential \
8
  curl \
@@ -11,27 +12,28 @@ RUN apt-get update && apt-get install -y \
11
  libglib2.0-0 \
12
  && rm -rf /var/lib/apt/lists/*
13
 
14
- # 2. Actualizar pip para evitar errores de compilaci贸n
15
  RUN pip install --no-cache-dir --upgrade pip
16
 
17
- # 3. INSTALAR TORCH CPU (El paso cr铆tico)
18
- # Instalamos esto SOLITO primero para asegurar que sea la versi贸n ligera (~150MB)
19
- # y no la versi贸n GPU (~2GB) que rompe la memoria.
 
 
20
  RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
21
 
22
- # 4. Instalar las librer铆as ligeras (desde requirements.txt)
23
- COPY requirements.txt .
24
- RUN pip install --no-cache-dir -r requirements.txt
25
 
26
- # 5. Instalar EasyOCR y OpenCV al final
27
- # Lo hacemos aparte para que no intenten reinstalar Torch GPU
28
- RUN pip install --no-cache-dir easyocr opencv-python-headless
29
 
30
- # 6. Copiar el c贸digo del proyecto
31
  COPY . .
32
 
33
- # 7. Configuraci贸n de arranque
34
  EXPOSE 8501
35
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
36
-
37
  ENTRYPOINT ["streamlit", "run", "main.py", "--server.port=8501", "--server.address=0.0.0.0"]
 
1
+ # Usamos Python 3.10 Slim
2
  FROM python:3.10-slim
3
 
4
  WORKDIR /app
5
 
6
+ # --- PASO 1: Dependencias de Linux (Vitales para OpenCV) ---
7
  RUN apt-get update && apt-get install -y \
8
  build-essential \
9
  curl \
 
12
  libglib2.0-0 \
13
  && rm -rf /var/lib/apt/lists/*
14
 
15
+ # --- PASO 2: Actualizar PIP ---
16
  RUN pip install --no-cache-dir --upgrade pip
17
 
18
+ # --- PASO 3: Stack Cient铆fico (Primero, porque tardan en compilar) ---
19
+ RUN pip install --no-cache-dir pandas numpy scikit-learn tqdm
20
+
21
+ # --- PASO 4: PyTorch CPU (El m谩s pesado, lo instalamos aislado) ---
22
+ # Usamos --index-url para forzar la versi贸n ligera de CPU (~150MB vs 2GB)
23
  RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
24
 
25
+ # --- PASO 5: Stack de NLP ---
26
+ # Importante: huggingface-hub<1.0 para compatibilidad
27
+ RUN pip install --no-cache-dir "huggingface-hub<1.0" transformers nltk
28
 
29
+ # --- PASO 6: Stack de Visi贸n y Web ---
30
+ # Instalamos easyocr al final para que no intente pelear con la versi贸n de torch
31
+ RUN pip install --no-cache-dir streamlit opencv-python-headless easyocr
32
 
33
+ # --- PASO 7: Copiar el C贸digo (Al final para aprovechar cach茅) ---
34
  COPY . .
35
 
36
+ # --- Configuraci贸n de Arranque ---
37
  EXPOSE 8501
38
  HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
 
39
  ENTRYPOINT ["streamlit", "run", "main.py", "--server.port=8501", "--server.address=0.0.0.0"]