FROM python:3.11-slim # Prevent Python from writing .pyc files & buffer stdout/stderr ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 WORKDIR /app # Install dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy backend source code COPY . . # Hugging Face Spaces uses port 7860 by default (Cloud Run sets PORT=8080 automatically) ENV PORT=7860 EXPOSE 7860 CMD ["sh", "-c", "exec uvicorn main:app --host 0.0.0.0 --port ${PORT:-7860}"]