Spaces:
Sleeping
Sleeping
| # ββ AIM Dashboard β Dockerfile ββββββββββββββββββββββββββββββββββββββββββββββ | |
| # Imagen base: Python 3.11 slim para menor tamaΓ±o | |
| FROM python:3.11-slim | |
| # Metadatos | |
| LABEL maintainer="tu-equipo@empresa.cl" | |
| LABEL description="AIM Dashboard β Perfil de ciberseguridad para PyMEs" | |
| # Variables de entorno | |
| ENV PYTHONDONTWRITEBYTECODE=1 \ | |
| PYTHONUNBUFFERED=1 \ | |
| PORT=7860 | |
| # Directorio de trabajo dentro del contenedor | |
| WORKDIR /app | |
| # Instalar dependencias del sistema (necesarias para torch y lxml) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| gcc \ | |
| g++ \ | |
| libxml2-dev \ | |
| libxslt-dev \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copiar solo el requirements primero (aprovecha cache de Docker) | |
| COPY requirements.txt . | |
| # Instalar dependencias Python | |
| # --no-cache-dir reduce el tamaΓ±o de imagen | |
| RUN pip install --upgrade pip && \ | |
| pip install --no-cache-dir -r requirements.txt && \ | |
| pip install --no-cache-dir gunicorn | |
| # Copiar el cΓ³digo del proyecto | |
| COPY . . | |
| # Puerto que expone la app | |
| EXPOSE 7860 | |
| # Comando de inicio con Gunicorn | |
| # - 2 workers (ajustar segΓΊn CPU disponibles: 2 * num_cpus + 1) | |
| # - timeout 300s porque el anΓ‘lisis NLP puede tardar varios minutos | |
| # - El objeto WSGI de Dash se llama "server" dentro de app.py | |
| CMD ["gunicorn", \ | |
| "--workers", "2", \ | |
| "--timeout", "300", \ | |
| "--bind", "0.0.0.0:7860", \ | |
| "--log-level", "info", \ | |
| "--access-logfile", "-", \ | |
| "--error-logfile", "-", \ | |
| "app:server"] | |