Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +16 -14
Dockerfile
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
# 1
|
| 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
|
| 15 |
RUN pip install --no-cache-dir --upgrade pip
|
| 16 |
|
| 17 |
-
# 3
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
| 20 |
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
|
| 21 |
|
| 22 |
-
#
|
| 23 |
-
|
| 24 |
-
RUN pip install --no-cache-dir -
|
| 25 |
|
| 26 |
-
#
|
| 27 |
-
#
|
| 28 |
-
RUN pip install --no-cache-dir
|
| 29 |
|
| 30 |
-
#
|
| 31 |
COPY . .
|
| 32 |
|
| 33 |
-
#
|
| 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"]
|