| # 1. Base Image: Use a lightweight Python 3.9 image | |
| FROM python:3.9-slim | |
| # 2. Set the working directory inside the container | |
| WORKDIR /app | |
| # 3. Install system-level build tools (in case pip needs to compile) | |
| RUN apt-get update && apt-get install -y build-essential | |
| # 4. Copy and install requirements first (for better caching) | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 5. Copy the rest of the application files | |
| COPY . . | |
| # 6. Expose the port the app runs on | |
| EXPOSE 7860 | |
| # 7. Define the command to run the application | |
| CMD ["gunicorn", "--bind", "0.0.0.0:7860", "app:superkart_api"] | |