Spaces:
Sleeping
Sleeping
| # 1. Base image | |
| FROM python:3.9-slim | |
| # 2. Prevent __pycache__, buffer logs | |
| ENV PYTHONDONTWRITEBYTECODE=1 | |
| ENV PYTHONUNBUFFERED=1 | |
| # 3. Define where uploads go | |
| ENV UPLOAD_DIR=/mnt/data | |
| # 4. Set working dir | |
| WORKDIR /app | |
| # 5. System deps (only if you need to compile wheels) | |
| RUN apt-get update \ | |
| && apt-get install -y --no-install-recommends build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # 6. Python deps | |
| COPY requirements.txt . | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # 7. Copy app code | |
| COPY . . | |
| # 8. Pre-create writable dirs | |
| RUN mkdir -p "${UPLOAD_DIR}/uploads" static/images \ | |
| && chmod -R 777 "${UPLOAD_DIR}/uploads" static/images | |
| # 9. Expose & run | |
| EXPOSE 7860 | |
| CMD ["gunicorn", "--workers", "4", "--bind", "0.0.0.0:7860", "app:app"] | |