File size: 1,012 Bytes
1ebdc66
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
27
28
29
30
31
# ---- Base image ----
FROM python:3.11-slim

# ---- System setup (add OS libs your deps may need) ----
# Add or remove packages as needed. Keep it small to speed builds.
RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential \
    && rm -rf /var/lib/apt/lists/*

# ---- App files ----
WORKDIR /app
# Copy only requirements first to leverage Docker layer caching
COPY requirements.txt /app/requirements.txt
RUN pip install --no-cache-dir -r requirements.txt

# Now copy the rest of your code
COPY . /app

# ---- Runtime env ----
# HF Spaces provides a PORT env var; default to 7860 for local runs
ENV PORT=7860
ENV PYTHONUNBUFFERED=1

# Make sure Flask binds publicly; gunicorn will use $PORT
EXPOSE 7860

# ---- Start command ----
# Gunicorn will import your Flask app named "app" from run.py
# If your app variable has a different name, change run:app accordingly.
CMD ["gunicorn", "run:app", "--workers", "2", "--threads", "8", "--timeout", "120", "--bind", "0.0.0.0:${PORT}"]