File size: 876 Bytes
6f54a86
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.11-slim

# Ajustes básicos de Python
ENV PYTHONDONTWRITEBYTECODE=1
ENV PYTHONUNBUFFERED=1

# Directorio de trabajo
WORKDIR /app

# Dependencias del sistema (ajusta si luego te falta algo tipo faiss, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# Instalar dependencias de Python
COPY requirements.txt .
RUN pip install --no-cache-dir --upgrade pip && \
    pip install --no-cache-dir -r requirements.txt

# Copiar el resto del proyecto
COPY . .

# Puerto que usará la Space (HF inyecta $PORT, normalmente 7860)
ENV PORT=7860
EXPOSE 7860

# Lanzar backend (FastAPI) y luego frontend (Streamlit)
CMD uvicorn app.api_server:app --host 0.0.0.0 --port 8000 & \
    sleep 3 && \
    streamlit run app/app_front.py \
        --server.port ${PORT} \
        --server.address 0.0.0.0