File size: 918 Bytes
effc62f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
FROM python:3.10-slim

ENV PYTHONUNBUFFERED=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1 \
    PORT=7860

# -------- system deps (curl for healthcheck)
RUN apt-get update && apt-get install -y --no-install-recommends \
    curl \
 && rm -rf /var/lib/apt/lists/*

# -------- workdir
WORKDIR /app

# -------- python deps
COPY requirements.txt /app/
RUN pip install --upgrade pip && pip install --no-cache-dir -r requirements.txt

# -------- app code
# (Put ALL your python files in the image)
COPY . /app

# -------- healthcheck & run
# Hugging Face probes container health; probing "/" is the simplest + most robust for Streamlit
HEALTHCHECK --interval=30s --timeout=5s --start-period=30s --retries=5 \
  CMD curl --fail http://127.0.0.1:${PORT}/ || exit 1

# Streamlit must bind to 0.0.0.0 and HF's provided $PORT
CMD ["streamlit", "run", "frontend.py", "--server.port=${PORT}", "--server.address=0.0.0.0"]