FROM python:3.12-slim # Set environment variables ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 ENV DEBIAN_FRONTEND=noninteractive # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ build-essential \ libgomp1 \ curl \ && apt-get clean && rm -rf /var/lib/apt/lists/* # Copy requirements and install dependencies COPY backend/requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the entire project COPY . . # Set PYTHONPATH to include the project root ENV PYTHONPATH=/app # Health check HEALTHCHECK --interval=30s --timeout=10s --retries=3 \ CMD curl -f http://localhost:7860/health || exit 1 # Expose the API port EXPOSE 7860 # Command to run the API server CMD ["uvicorn", "backend.api_server:app", "--host", "0.0.0.0", "--port", "7860"]