| # Use an official Python runtime as a parent image | |
| FROM python:3.9-slim | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements file into the container at /app (corrected path) | |
| COPY requirements.txt . | |
| # Install any needed packages specified in requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the Flask application file into the container at /app (corrected path) | |
| COPY app.py . | |
| # Copy the trained model file into the container at /app (corrected path) | |
| COPY best_rf_model.joblib . | |
| # Expose the port that the app will run on | |
| EXPOSE 8000 | |
| # Run Gunicorn to serve the Flask application | |
| # The 'app:app' refers to the 'app' object in the 'app.py' file | |
| CMD ["gunicorn", "--bind", "0.0.0.0:8000", "app:app"] | |