Spaces:
Running
Running
Update Dockerfile
Browse files- Dockerfile +21 -18
Dockerfile
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
-
#
|
2 |
-
FROM python:3.9-slim
|
3 |
|
4 |
# --- Environment ---
|
5 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
@@ -7,30 +7,33 @@ ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
7 |
STREAMLIT_HOME=/tmp/.streamlit \
|
8 |
HOME=/tmp
|
9 |
|
|
|
10 |
RUN mkdir -p $STREAMLIT_HOME
|
11 |
|
12 |
-
# --- System
|
13 |
-
RUN apt-get update &&
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
|
|
19 |
&& rm -rf /var/lib/apt/lists/*
|
20 |
|
21 |
-
# --- Python
|
22 |
RUN pip install --no-cache-dir \
|
23 |
-
streamlit==1.45.1 \
|
24 |
-
pillow \
|
25 |
-
pypandoc \
|
26 |
-
ffmpeg-python \
|
27 |
-
python-magic
|
28 |
|
29 |
-
# ---
|
30 |
COPY app.py /app/app.py
|
31 |
WORKDIR /app
|
32 |
|
33 |
-
# --- Expose
|
34 |
-
EXPOSE 7860
|
35 |
|
|
|
36 |
CMD ["streamlit", "run", "app.py"]
|
|
|
1 |
+
# Use Python 3.9 on Debian slim (runs as root by default)
|
2 |
+
FROM python:3.9-slim-bookworm
|
3 |
|
4 |
# --- Environment ---
|
5 |
ENV PYTHONDONTWRITEBYTECODE=1 \
|
|
|
7 |
STREAMLIT_HOME=/tmp/.streamlit \
|
8 |
HOME=/tmp
|
9 |
|
10 |
+
# Create Streamlit config directory (owned by root, writable by root)
|
11 |
RUN mkdir -p $STREAMLIT_HOME
|
12 |
|
13 |
+
# --- System dependencies for conversion libraries ---
|
14 |
+
RUN apt-get update && \
|
15 |
+
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
|
16 |
+
pandoc \ # for pypandoc conversions :contentReference[oaicite:2]{index=2}
|
17 |
+
unoconv \ # headless LibreOffice converter :contentReference[oaicite:3]{index=3}
|
18 |
+
libreoffice-core \ # LibreOffice engine for unoconv :contentReference[oaicite:4]{index=4}
|
19 |
+
ffmpeg \ # audio/video processing :contentReference[oaicite:5]{index=5}
|
20 |
+
libmagic1 \ # magic library for python-magic :contentReference[oaicite:6]{index=6}
|
21 |
&& rm -rf /var/lib/apt/lists/*
|
22 |
|
23 |
+
# --- Python dependencies ---
|
24 |
RUN pip install --no-cache-dir \
|
25 |
+
streamlit==1.45.1 \ # Streamlit with event-loop fix :contentReference[oaicite:7]{index=7}
|
26 |
+
pillow \ # image conversions :contentReference[oaicite:8]{index=8}
|
27 |
+
pypandoc \ # text/markup conversions :contentReference[oaicite:9]{index=9}
|
28 |
+
ffmpeg-python \ # wrapper for ffmpeg :contentReference[oaicite:10]{index=10}
|
29 |
+
python-magic # MIME detection :contentReference[oaicite:11]{index=11}
|
30 |
|
31 |
+
# --- Copy application code ---
|
32 |
COPY app.py /app/app.py
|
33 |
WORKDIR /app
|
34 |
|
35 |
+
# --- Expose Streamlit port for Spaces (7860) ---
|
36 |
+
EXPOSE 7860 # Hugging Face Spaces default :contentReference[oaicite:12]{index=12}
|
37 |
|
38 |
+
# --- Launch the Streamlit app as root ---
|
39 |
CMD ["streamlit", "run", "app.py"]
|