| # Use an official lightweight Python image | |
| FROM python:3.9-slim | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Copy the requirements file into the container | |
| COPY requirements.txt . | |
| # Install the Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the Flask API script into the container | |
| COPY app.py . | |
| # Expose the port the app runs | |
| EXPOSE 7860 | |
| # Command to run the application using Gunicorn | |
| CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:app"] | |