FROM python:3.9-slim WORKDIR /app # Instalar curl para el healthcheck RUN apt-get update && apt-get install -y curl && rm -rf /var/lib/apt/lists/* # Crear directorio de caché y configurar permisos RUN mkdir -p /app/.cache && \ mkdir -p /app/configs && \ chmod -R 777 /app/.cache && \ chmod -R 777 /app/configs # Copiar e instalar dependencias COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copiar el resto de los archivos COPY . . # Configurar variables de entorno ENV HF_HOME=/app/.cache ENV TRANSFORMERS_CACHE=/app/.cache ENV STREAMLIT_SERVER_PORT=8501 ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 EXPOSE 8501 HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health # Usar un usuario no root USER nobody CMD ["streamlit", "run", "app.py"]