Spaces:
Sleeping
Sleeping
| # Use an official lightweight Python image | |
| FROM python:3.11-slim | |
| # Prevent Python from buffering stdout/stderr | |
| ENV PYTHONUNBUFFERED=1 | |
| # Set working directory inside container | |
| WORKDIR /app | |
| # Install system dependencies (TensorFlow sometimes needs these) | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| libssl-dev \ | |
| libffi-dev \ | |
| python3-dev \ | |
| curl \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy requirements first (better Docker caching) | |
| COPY requirements.txt . | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of your project into the container | |
| COPY . . | |
| # Expose port for FastAPI | |
| EXPOSE 7860 | |
| # Run FastAPI app with uvicorn | |
| CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"] | |