| FROM python:3.11 | |
| ENV DEBIAN_FRONTEND=noninteractive \ | |
| PYTHONUNBUFFERED=1 | |
| # Redis for JWT blacklist / rate-limiting (SQLite used instead of PostgreSQL) | |
| RUN apt-get update && apt-get install -y --no-install-recommends \ | |
| redis-server curl \ | |
| && apt-get clean && rm -rf /var/lib/apt/lists/* | |
| WORKDIR /app | |
| # Install Python dependencies (separate layer for caching) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Application source | |
| COPY alembic.ini . | |
| COPY alembic/ alembic/ | |
| COPY mac/ mac/ | |
| COPY frontend/build/ frontend/build/ | |
| # HF startup script | |
| COPY hf_start.sh /app/hf_start.sh | |
| RUN chmod +x /app/hf_start.sh | |
| # HF Spaces requires port 7860 | |
| EXPOSE 7860 | |
| CMD ["/app/hf_start.sh"] | |