| # Use an official Python runtime as a parent image | |
| FROM python:3.9-slim | |
| # Set environment variables | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| # Create a working directory | |
| WORKDIR /app | |
| # Copy requirements file and install dependencies | |
| COPY requirements.txt /app/ | |
| RUN pip install --upgrade pip \ | |
| && pip install --no-cache-dir -r requirements.txt | |
| # Copy the rest of the application code | |
| COPY . /app | |
| # Expose port 7860 for the API | |
| EXPOSE 7860 | |
| # Command to run the application using Uvicorn | |
| CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"] | |