dimemex / Dockerfile
julianzrmrz's picture
fix: force torch cpu install in dockerfile
86468f8 verified
raw
history blame
1.3 kB
# Usamos Python 3.10 Slim (m谩s ligero y estable)
FROM python:3.10-slim
# Directorio de trabajo
WORKDIR /app
# 1. INSTALAR DEPENDENCIAS DE SISTEMA (Vital para OpenCV y Git LFS)
# Se hace en un solo RUN para reducir capas
RUN apt-get update && apt-get install -y \
build-essential \
curl \
git \
libgl1-mesa-glx \
libglib2.0-0 \
&& rm -rf /var/lib/apt/lists/*
# 2. INSTALAR GIT LFS
RUN curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | bash && \
apt-get install -y git-lfs && \
git lfs install
# 3. ACTUALIZAR PIP (Evita errores de compilaci贸n con librer铆as nuevas)
RUN pip install --upgrade pip
# 4. INSTALAR PYTORCH CPU PRIMERO (Truco de optimizaci贸n de memoria)
# Esto evita descargar la versi贸n GPU de 2GB que rompe el build
RUN pip install --no-cache-dir torch torchvision --index-url https://download.pytorch.org/whl/cpu
# 5. COPIAR Y INSTALAR REQUERIMIENTOS
COPY requirements.txt .
# El flag --no-cache-dir ahorra espacio en disco
RUN pip install --no-cache-dir -r requirements.txt
# 6. COPIAR TU PROYECTO
COPY . .
# 7. CONFIGURACI脫N DE ARRANQUE
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
ENTRYPOINT ["streamlit", "run", "main.py", "--server.port=8501", "--server.address=0.0.0.0"]