File size: 853 Bytes
3b5f3ab
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 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"]