| # Use an official Python runtime as a parent image | |
| FROM python:3.9-slim-buster | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements file into the container at /app | |
| COPY requirements.txt . | |
| # Install any needed packages specified in requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the Flask application and the trained model into the container at /app | |
| COPY app.py . | |
| COPY best_sales_forecasting_model.joblib . | |
| # Expose the port that the Flask app will run on | |
| EXPOSE 5000 | |
| # Define environment variables for Flask | |
| ENV FLASK_APP=app.py | |
| ENV FLASK_RUN_HOST=0.0.0.0 | |
| ENV FLASK_RUN_PORT=5000 | |
| # Run the Flask application | |
| CMD ["flask", "run"] | |