File size: 1,224 Bytes
25a71e0
 
cd49ad0
25a71e0
 
 
 
 
 
 
cd49ad0
 
25a71e0
 
 
 
 
 
 
 
f198439
25a71e0
 
 
cd49ad0
 
25a71e0
cd49ad0
 
25a71e0
 
 
 
 
 
cd49ad0
25a71e0
 
 
 
cb10afe
 
 
cd49ad0
25a71e0
cd49ad0
25a71e0
cb10afe
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# Hugging Face Spaces - Dockerized Streamlit app
FROM python:3.10-slim

# Prevent Python from writing .pyc files and enable unbuffered logs
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    PIP_NO_CACHE_DIR=1 \
    PIP_DISABLE_PIP_VERSION_CHECK=1

# Workdir
WORKDIR /app

# System deps (opencv, fonts, image libs, etc.)
RUN apt-get update && apt-get install -y --no-install-recommends \
        build-essential \
        git \
        ffmpeg \
        libsm6 \
        libxext6 \
        libglib2.0-0 \
        libgl1 \
        libgtk2.0-dev \
        libgtk-3-dev \
        ca-certificates \
    && rm -rf /var/lib/apt/lists/*

# Copy dependency list first (better layer caching)
COPY requirements.txt ./

# Install Python deps
RUN pip install --upgrade pip && \
    pip install -r requirements.txt

# Copy app source
COPY . .

# Streamlit configuration for Spaces
ENV PORT=7860 \
    STREAMLIT_SERVER_PORT=7860 \
    STREAMLIT_SERVER_HEADLESS=true \
    STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
    STREAMLIT_SERVER_ENABLE_CORS=false \
    STREAMLIT_SERVER_ENABLE_XSRF_PROTECTION=false

EXPOSE 7860

# Entrypoint - run Streamlit app
CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]