Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +19 -24
Dockerfile
CHANGED
|
@@ -2,36 +2,31 @@ FROM python:3.9-slim
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
-
#
|
| 6 |
-
RUN apt-get update && apt-get install -y \
|
| 7 |
-
|
| 8 |
-
curl \
|
| 9 |
-
software-properties-common \
|
| 10 |
-
git \
|
| 11 |
-
ffmpeg \
|
| 12 |
-
libsm6 \
|
| 13 |
-
libxext6 \
|
| 14 |
-
libxrender-dev \
|
| 15 |
-
libgl1-mesa-glx \
|
| 16 |
-
# Add fontconfig for font management
|
| 17 |
-
fontconfig \
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
| 20 |
-
#
|
| 21 |
-
# Create writable cache directories inside the app's working directory
|
| 22 |
RUN mkdir -p /app/.cache/matplotlib /app/.cache/fontconfig
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
ENV FONTCONFIG_PATH /app/.cache/fontconfig
|
| 26 |
-
# --- END OF FIX ---
|
| 27 |
|
| 28 |
-
COPY requirements.txt
|
| 29 |
-
RUN
|
| 30 |
|
|
|
|
| 31 |
COPY src/ ./src/
|
|
|
|
| 32 |
|
| 33 |
-
|
|
|
|
| 34 |
|
| 35 |
-
|
|
|
|
| 36 |
|
| 37 |
-
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py",
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
|
| 3 |
WORKDIR /app
|
| 4 |
|
| 5 |
+
# System deps
|
| 6 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 7 |
+
ffmpeg libsm6 libxext6 libxrender-dev libgl1-mesa-glx fontconfig \
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
&& rm -rf /var/lib/apt/lists/*
|
| 9 |
|
| 10 |
+
# Cache dirs that must be writable
|
|
|
|
| 11 |
RUN mkdir -p /app/.cache/matplotlib /app/.cache/fontconfig
|
| 12 |
+
ENV MPLCONFIGDIR=/app/.cache/matplotlib \
|
| 13 |
+
FONTCONFIG_PATH=/app/.cache/fontconfig
|
|
|
|
|
|
|
| 14 |
|
| 15 |
+
COPY requirements.txt .
|
| 16 |
+
RUN pip install --no-cache-dir -r requirements.txt
|
| 17 |
|
| 18 |
+
# Copy code and Streamlit config
|
| 19 |
COPY src/ ./src/
|
| 20 |
+
COPY .streamlit/ ./.streamlit/
|
| 21 |
|
| 22 |
+
# Expose the port the Space will hit
|
| 23 |
+
EXPOSE 7860
|
| 24 |
|
| 25 |
+
# IMPORTANT: use the port env var Hugging Face injects
|
| 26 |
+
ENV PORT=7860
|
| 27 |
|
| 28 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", \
|
| 29 |
+
"--server.headless=true", \
|
| 30 |
+
"--server.port=7860", \
|
| 31 |
+
"--server.enableXsrfProtection=false", \
|
| 32 |
+
"--server.enableCORS=false"]
|