File size: 1,992 Bytes
175f99d
 
b92009b
b456e6f
 
 
 
 
b92009b
175f99d
b456e6f
b92009b
175f99d
 
 
 
 
 
 
 
3fb3cb2
b92009b
175f99d
3fb3cb2
175f99d
 
 
 
 
3fb3cb2
175f99d
b456e6f
 
b92009b
175f99d
 
3fb3cb2
175f99d
fb70a1b
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
# Use Python 3.9 on Debian slim (runs as root by default)
FROM python:3.9-slim-bookworm

# --- Environment ---
ENV PYTHONDONTWRITEBYTECODE=1 \
    PYTHONUNBUFFERED=1 \
    STREAMLIT_HOME=/tmp/.streamlit \
    HOME=/tmp

# Create Streamlit config directory (owned by root, writable by root)
RUN mkdir -p $STREAMLIT_HOME

# --- System dependencies for conversion libraries ---
RUN apt-get update && \
    DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
      pandoc \                                # for pypandoc conversions :contentReference[oaicite:2]{index=2}
      unoconv \                               # headless LibreOffice converter :contentReference[oaicite:3]{index=3}
      libreoffice-core \                      # LibreOffice engine for unoconv :contentReference[oaicite:4]{index=4}
      ffmpeg \                                # audio/video processing :contentReference[oaicite:5]{index=5}
      libmagic1 \                             # magic library for python-magic :contentReference[oaicite:6]{index=6}
 && rm -rf /var/lib/apt/lists/*

# --- Python dependencies ---
RUN pip install --no-cache-dir \
    streamlit==1.45.1 \                      # Streamlit with event-loop fix :contentReference[oaicite:7]{index=7}
    pillow \                                 # image conversions :contentReference[oaicite:8]{index=8}
    pypandoc \                               # text/markup conversions :contentReference[oaicite:9]{index=9}
    ffmpeg-python \                          # wrapper for ffmpeg :contentReference[oaicite:10]{index=10}
    python-magic                           # MIME detection :contentReference[oaicite:11]{index=11}

# --- Copy application code ---
COPY app.py /app/app.py
WORKDIR /app

# --- Expose Streamlit port for Spaces (7860) ---
EXPOSE 7860                                # Hugging Face Spaces default :contentReference[oaicite:12]{index=12}

# --- Launch the Streamlit app as root ---
CMD ["streamlit", "run", "app.py"]