| # Use a lightweight Python base image | |
| FROM python:3.10-slim | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| RUN apt-get update && apt-get install -y build-essential | |
| RUN pip install --upgrade pip | |
| # Copy the requirements file and install dependencies | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the Flask application code and the trained model file | |
| COPY app.py . | |
| COPY superkart_sale_prediction_model_v1_0.joblib . | |
| # Expose the port the Flask app will run on | |
| EXPOSE 7860 | |
| # Command to run the Flask application using Gunicorn | |
| # Gunicorn is a popular WSGI server for Python web applications | |
| CMD ["gunicorn", "-w", "4", "--bind", "0.0.0.0:7860", "--capture-output", "--enable-stdio-inheritance", "--log-level", "trace", "app:app"] | |