# Dockerfile # Use a specific Python base image for stability and size optimization FROM python:3.12-slim # Set the working directory inside the container WORKDIR /app # Copy the requirements file and install dependencies # Use --no-cache-dir to keep the image size small COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the Flask application and the serialized model COPY app.py . COPY tuned_xgb_sales_forecaster.pkl . COPY tuned_xgb_sales_forecaster.json . COPY SuperKart.csv . # Expose the port the Flask app will run on EXPOSE 7860 # Command to Start the Application (Gunicorn) # This is the crucial part, borrowing from your colleague's working model: # - `-w 4`: 4 worker processes for concurrency # - `-b 0.0.0.0:7860`: Binds to the required port and all interfaces # - `app:app`: The application target. It means: # - look in file 'app.py' (the first 'app') # - for the Flask instance named 'app' (the second 'app') CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:app"]