Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +54 -51
Dockerfile
CHANGED
|
@@ -1,52 +1,55 @@
|
|
| 1 |
-
# Use Python base image
|
| 2 |
-
FROM python:3.10-slim
|
| 3 |
-
|
| 4 |
-
# Set working directory
|
| 5 |
-
WORKDIR /app
|
| 6 |
-
|
| 7 |
-
# Install system dependencies including FFmpeg
|
| 8 |
-
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
-
ffmpeg \
|
| 10 |
-
libsm6 \
|
| 11 |
-
libxext6 \
|
| 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 |
CMD ["streamlit", "run", "app.py"]
|
|
|
|
| 1 |
+
# Use Python base image
|
| 2 |
+
FROM python:3.10-slim
|
| 3 |
+
|
| 4 |
+
# Set working directory
|
| 5 |
+
WORKDIR /app
|
| 6 |
+
|
| 7 |
+
# Install system dependencies including FFmpeg
|
| 8 |
+
RUN apt-get update && apt-get install -y --no-install-recommends \
|
| 9 |
+
ffmpeg \
|
| 10 |
+
libsm6 \
|
| 11 |
+
libxext6 \
|
| 12 |
+
libxrender1 \
|
| 13 |
+
libgl1 \
|
| 14 |
+
libglib2.0-0 \
|
| 15 |
+
git \
|
| 16 |
+
curl \
|
| 17 |
+
&& apt-get clean \
|
| 18 |
+
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
+
|
| 20 |
+
# Create non-root user for security (required by HF Spaces)
|
| 21 |
+
RUN useradd -m -u 1000 user
|
| 22 |
+
USER user
|
| 23 |
+
ENV HOME=/home/user \
|
| 24 |
+
PATH=/home/user/.local/bin:$PATH
|
| 25 |
+
|
| 26 |
+
# Set working directory for user
|
| 27 |
+
WORKDIR $HOME/app
|
| 28 |
+
|
| 29 |
+
# Copy requirements first (for caching)
|
| 30 |
+
COPY --chown=user:user requirements.txt .
|
| 31 |
+
|
| 32 |
+
# Install Python dependencies
|
| 33 |
+
RUN pip install --no-cache-dir --upgrade pip && \
|
| 34 |
+
pip install --no-cache-dir -r requirements.txt
|
| 35 |
+
|
| 36 |
+
# Copy application files
|
| 37 |
+
COPY --chown=user:user . .
|
| 38 |
+
|
| 39 |
+
# Create temp directory
|
| 40 |
+
RUN mkdir -p temp
|
| 41 |
+
|
| 42 |
+
# Expose Streamlit port
|
| 43 |
+
EXPOSE 7860
|
| 44 |
+
|
| 45 |
+
# Health check
|
| 46 |
+
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
|
| 47 |
+
|
| 48 |
+
# Set environment variables for Streamlit
|
| 49 |
+
ENV STREAMLIT_SERVER_PORT=7860 \
|
| 50 |
+
STREAMLIT_SERVER_ADDRESS=0.0.0.0 \
|
| 51 |
+
STREAMLIT_SERVER_HEADLESS=true \
|
| 52 |
+
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false
|
| 53 |
+
|
| 54 |
+
# Run the application
|
| 55 |
CMD ["streamlit", "run", "app.py"]
|