Spaces:
Sleeping
Sleeping
| # 1. Use a slim version of Python to keep the image size down | |
| FROM python:3.10-slim | |
| # 2. Set up a non-root user (Hugging Face default is UID 1000) | |
| RUN useradd -m -u 1000 user | |
| USER user | |
| ENV HOME=/home/user \ | |
| PATH=/home/user/.local/bin:/usr/games:$PATH | |
| # 3. Set the working directory | |
| WORKDIR $HOME/app | |
| # 4. Install requirements | |
| RUN pip install --no-cache-dir flask gunicorn | |
| # 5. Copy the rest of the application | |
| COPY --chown=user . . | |
| # 6. Expose the port (informative only) | |
| EXPOSE 7860 | |
| # 7. Launch | |
| CMD ["gunicorn", \ | |
| "--bind", "0.0.0.0:7860", \ | |
| "--timeout", "1000", \ | |
| "--worker-class", "gthread", \ | |
| "app:app"] |