File size: 673 Bytes
10f9b29
 
 
 
 
 
 
c289bbd
10f9b29
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# 1. Start with a lightweight Python image
FROM python:3.10-slim

# 2. Set the directory inside the cloud server
WORKDIR /app

# 3. Install required system libraries for OpenCV to work in the cloud
RUN apt-get update && apt-get install -y libgl1 libglib2.0-0

# 4. Copy your requirements file and install the Python libraries
COPY requirements.txt .
RUN pip install --no-cache-dir -r requirements.txt

# 5. Copy all your project files (app.py, templates, models, etc.)
COPY . .

# 6. Hugging Face exposes port 7860 by default
EXPOSE 7860

# 7. Start the Flask server using Gunicorn (production-ready)
CMD ["gunicorn", "-b", "0.0.0.0:7860", "--timeout", "120", "server:app"]