File size: 1,587 Bytes
7adf02c
 
 
 
 
 
 
 
 
 
 
e95b7ef
7adf02c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e95b7ef
7adf02c
 
 
 
 
 
 
 
e95b7ef
7adf02c
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# ── 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"]