Files
dashboard-leads/backend/Dockerfile

33 lines
1.1 KiB
Docker

FROM python:3.11-slim
WORKDIR /app
# Dependencias del sistema necesarias para pyodbc (via FreeTDS) y psycopg2
RUN apt-get update && apt-get install -y --no-install-recommends \
gcc \
g++ \
unixodbc \
unixodbc-dev \
freetds-dev \
freetds-bin \
tdsodbc \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Registrar el driver FreeTDS bajo el nombre "SQL Server" (el que usa data_manager.py)
RUN printf "[SQL Server]\nDescription = FreeTDS Driver\nDriver = /usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so\nSetup = /usr/lib/x86_64-linux-gnu/odbc/libtdsS.so\nFileUsage = 1\n" > /etc/odbcinst.ini
# Configurar FreeTDS explicitamente: version de protocolo TDS, puerto y cifrado.
# "encryption = off" evita fallos de negociacion con SQL Servers antiguos/mal configurados.
# TDSDUMP habilita un log detallado para diagnosticar fallos de conexion.
RUN printf "[global]\n\tport = 1433\n\ttds version = 7.3\n\tclient charset = UTF-8\n\tencryption = off\n" > /etc/freetds/freetds.conf
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt
COPY . .
EXPOSE 8001
CMD ["python", "main.py"]