file_extension_change / Dockerfile
euler314's picture
Update Dockerfile
175f99d verified
raw
history blame
1.99 kB
# 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"]