Spaces:
Running
Running
| # Backend container — runs the FastAPI app in mock mode (CPU only, no GPU). | |
| # Works on Hugging Face Spaces (Docker), Render, Fly.io, Railway, etc. | |
| FROM python:3.11-slim | |
| # System libs needed by OpenCV (headless) at import time. | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| libgl1 libglib2.0-0 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| COPY backend/requirements.txt ./requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY backend/ ./ | |
| # Pre-render the catalog placeholder images at build time. | |
| RUN python scripts/generate_catalog_images.py || true | |
| ENV IMAGE_PROVIDER=mock \ | |
| PYTHONUNBUFFERED=1 | |
| # Hugging Face Spaces uses 7860; Render/Fly inject $PORT. Default to 7860. | |
| # --proxy-headers makes request-based asset URLs come out as https behind the host proxy. | |
| EXPOSE 7860 | |
| CMD ["sh", "-c", "uvicorn app.main:app --host 0.0.0.0 --port ${PORT:-7860} --proxy-headers --forwarded-allow-ips='*'"] | |