Spaces:
Sleeping
Sleeping
| # Use an official Python runtime as a parent image | |
| FROM python:3.9-slim | |
| # Set the working directory in the container | |
| WORKDIR /app | |
| # Copy the current directory contents (app.py, index.html, data.json if exists) | |
| # into the container at /app | |
| COPY . /app/ | |
| # Install Python dependencies | |
| RUN pip install --no-cache-dir Flask requests gunicorn | |
| # Make port 7860 available to the world outside this container | |
| # Hugging Face Spaces typically use this port for web apps | |
| EXPOSE 7860 | |
| # Environment variable for Flask (optional, Gunicorn overrides some) | |
| ENV FLASK_APP=app.py | |
| # Command to run the application using Gunicorn | |
| # Use 1 worker for simplicity on free HF Spaces, with multiple threads. | |
| # Threads allow background pingers to run alongside Flask request handling. | |
| CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "10", "app:app"] |