# Use official Python image FROM python:3.11-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Set working directory WORKDIR /app # Copy requirements first for caching COPY requirements.txt . # Install dependencies RUN pip install --upgrade pip RUN pip install --no-cache-dir -r requirements.txt # Copy app code COPY . . # Expose port (Render uses 10000+ dynamic ports, we'll override with CMD) EXPOSE 7860 # Redirect local storage and cache to /tmp ENV HOME=/tmp ENV XDG_DATA_HOME=/tmp/.local/share # Command to run the FastAPI server CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]