# FinSight v3 API — build context is this backend/ directory. FROM python:3.11-slim # Keep Python lean and unbuffered so logs stream to the platform immediately. ENV PYTHONUNBUFFERED=1 \ PYTHONDONTWRITEBYTECODE=1 \ PIP_NO_CACHE_DIR=1 \ HF_HOME=/opt/hf WORKDIR /app COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Bake the sentence-transformers model into the image so the first request # doesn't pay a model download, and the container works even if outbound # access to the model hub is restricted at runtime. RUN python -c "from sentence_transformers import SentenceTransformer; SentenceTransformer('sentence-transformers/all-MiniLM-L6-v2')" COPY . . # Render (and most PaaS) inject $PORT. Bind 0.0.0.0 so it's reachable. # Single worker on purpose: each worker loads its own PyTorch model copy. EXPOSE 8000 CMD ["sh", "-c", "uvicorn main:app --host 0.0.0.0 --port ${PORT:-8000} --workers 1"]