Spaces:
Sleeping
Sleeping
Create Dockerfile
Browse files- Dockerfile +24 -0
Dockerfile
ADDED
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Use an official Python runtime as a parent image
|
2 |
+
FROM python:3.9-slim
|
3 |
+
|
4 |
+
# Set the working directory in the container
|
5 |
+
WORKDIR /app
|
6 |
+
|
7 |
+
# Copy the current directory contents (app.py, index.html, data.json if exists)
|
8 |
+
# into the container at /app
|
9 |
+
COPY . /app/
|
10 |
+
|
11 |
+
# Install Python dependencies
|
12 |
+
RUN pip install --no-cache-dir Flask requests gunicorn
|
13 |
+
|
14 |
+
# Make port 7860 available to the world outside this container
|
15 |
+
# Hugging Face Spaces typically use this port for web apps
|
16 |
+
EXPOSE 7860
|
17 |
+
|
18 |
+
# Environment variable for Flask (optional, Gunicorn overrides some)
|
19 |
+
ENV FLASK_APP=app.py
|
20 |
+
|
21 |
+
# Command to run the application using Gunicorn
|
22 |
+
# Use 1 worker for simplicity on free HF Spaces, with multiple threads.
|
23 |
+
# Threads allow background pingers to run alongside Flask request handling.
|
24 |
+
CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "1", "--threads", "10", "app:app"]
|