File size: 1,538 Bytes
11d2fb8
56685c9
761ef85
56685c9
 
58ac34f
 
 
 
 
 
 
 
8be068b
761ef85
56685c9
 
 
b44c1bb
dc24e94
 
b44c1bb
5a6887e
56685c9
 
44164c6
56685c9
 
0274f2f
 
 
761ef85
 
 
 
 
 
 
b636b74
 
f77cdc7
09d56e7
f9010f1
56685c9
761ef85
 
512fe0d
9c5b720
 
44164c6
761ef85
56685c9
761ef85
56685c9
761ef85
bf1c821
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
49
50
51
52
53
54
55
56
57
FROM python:3.10

# Set working directory
WORKDIR /app

# # === ENV VARS ===
# ENV XDG_CONFIG_HOME=/tmp/.config \
#     XDG_CACHE_HOME=/tmp/.cache \
#     HF_HOME=/tmp/huggingface \
#     HF_HUB_CACHE=/tmp/huggingface/hub \
#     STREAMLIT_HOME=/tmp/.streamlit \
#     MPLCONFIGDIR=/tmp/matplotlib \
#     PYTHONUNBUFFERED=1

# === Install system packages ===
RUN apt-get update && apt-get install -y \
    build-essential \
    curl \
    pkg-config \
    libprotobuf-dev \
    protobuf-compiler \
    libsentencepiece-dev \
    ffmpeg \
    software-properties-common \
    git \
    jq \
    && rm -rf /var/lib/apt/lists/*

# === Install Python CLI packages ===
RUN pip install gdown

# === Create writable directories ===
RUN mkdir -p $XDG_CONFIG_HOME/streamlit $XDG_CACHE_HOME $HF_HUB_CACHE $STREAMLIT_HOME

# === Add basic Streamlit config ===
RUN echo "[server]\nheadless = true\nenableCORS = false\ndefaultPort = 8501" > $XDG_CONFIG_HOME/streamlit/config.toml

# === Copy app code ===
COPY --chown=user requirements.txt ./
COPY --chown=user app.py ./
COPY demos ./demos
COPY download_assets.sh ./


# === Install Python dependencies ===
RUN pip3 install --no-cache-dir -r requirements.txt

# Run the shell script to process JSON
RUN chmod +x download_assets.sh && ./download_assets.sh

# === Expose port & healthcheck ===
EXPOSE 8501
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health || exit 1

# === Run Streamlit app ===
ENTRYPOINT ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]