Spaces:
Sleeping
Sleeping
| # Use a smaller base image | |
| FROM python:3.9-slim | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the requirements file into the container | |
| COPY requirements.txt . | |
| # Install any needed packages specified in requirements.txt | |
| # Use --no-cache-dir to prevent caching of packages | |
| # Use -r to install from requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy the application code and the trained model into the container | |
| COPY app.py . | |
| COPY best_sales_forecasting_model.joblib . | |
| # Expose the port that the Flask app will run on | |
| EXPOSE 7860 | |
| # Define environment variable | |
| ENV FLASK_APP=app.py | |
| # Run the Flask application using a production-ready WSGI server like Gunicorn | |
| # Install gunicorn | |
| RUN pip install gunicorn==22.0.0 | |
| # Use gunicorn to run the Flask app with specified workers and threads | |
| CMD ["gunicorn", "-w", "4", "-b", "0.0.0.0:7860", "app:superkart_sales_api"] | |