File size: 728 Bytes
3c4d71f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
FROM python:3.9-slim

WORKDIR /app

# Create a user to run the app (Hugging Face Spaces requirement)
RUN useradd -m -u 1000 user

# Install required packages
COPY requirements.txt /app/
RUN pip install --no-cache-dir -r requirements.txt

# Copy the rest of the application
COPY . /app/

# Set ownership to the non-root user so the app can create and write to game.db
RUN chown -R user:user /app

# Switch to the non-root user
USER user

# Expose port 7860 which is the default for Hugging Face Spaces
EXPOSE 7860

# Use run:app (the create_app factory is invoked in run.py)
# eventlet worker is required for Flask-SocketIO WebSocket support
CMD ["gunicorn", "-k", "eventlet", "-b", "0.0.0.0:7860", "--timeout", "120", "run:app"]