| FROM python:3.9-slim | |
| WORKDIR /app | |
| COPY requirements.txt requirements.txt | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| COPY . . | |
| # Set cache directory to /tmp | |
| ENV XDG_CACHE_HOME=/tmp/.cache | |
| ENV MPLCONFIGDIR=/tmp/matplotlib | |
| EXPOSE 7860 | |
| # Run with gunicorn | |
| CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "app:app"] | |
| # FROM python:3.9-slim | |
| # WORKDIR /app | |
| # COPY requirements.txt requirements.txt | |
| # RUN pip install --no-cache-dir -r requirements.txt | |
| # COPY . . | |
| # EXPOSE 7860 | |
| # # Run with gunicorn instead of python | |
| # CMD ["gunicorn", "-w", "2", "-b", "0.0.0.0:7860", "app:app"] | |
| # # # Use a lightweight Python image | |
| # # FROM python:3.10-slim | |
| # # # Set working directory | |
| # # WORKDIR /app | |
| # # # Copy requirements first (for caching layers) | |
| # # COPY requirements.txt . | |
| # # # Install dependencies | |
| # # RUN pip install --no-cache-dir -r requirements.txt | |
| # # # Copy the rest of the code | |
| # # COPY . . | |
| # # # Expose the port Flask/Gunicorn will run on | |
| # # EXPOSE 5000 | |
| # # # Run with Gunicorn (production server) | |
| # # #CMD ["python", "app.py"] | |
| # # CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:5000", "--workers", "4"] |