Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +21 -17
Dockerfile
CHANGED
|
@@ -6,29 +6,33 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
|
|
| 6 |
ffmpeg \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
-
#
|
| 10 |
-
|
| 11 |
|
| 12 |
-
#
|
| 13 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
|
| 15 |
-
#
|
| 16 |
-
|
| 17 |
|
| 18 |
-
#
|
| 19 |
-
|
| 20 |
|
| 21 |
-
#
|
| 22 |
-
|
| 23 |
|
| 24 |
-
#
|
| 25 |
-
|
| 26 |
|
| 27 |
-
# Expose Streamlit port
|
| 28 |
-
EXPOSE
|
| 29 |
|
| 30 |
# Health check
|
| 31 |
-
HEALTHCHECK CMD curl --fail http://localhost:
|
| 32 |
|
| 33 |
-
# Run the app
|
| 34 |
-
CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=
|
|
|
|
| 6 |
ffmpeg \
|
| 7 |
&& rm -rf /var/lib/apt/lists/*
|
| 8 |
|
| 9 |
+
# Create non-root user for Hugging Face Spaces compatibility
|
| 10 |
+
RUN useradd -m -u 1000 user
|
| 11 |
|
| 12 |
+
# Set environment variables
|
| 13 |
+
ENV HOME=/home/user \
|
| 14 |
+
PATH=/home/user/.local/bin:$PATH \
|
| 15 |
+
PYTHONUNBUFFERED=1 \
|
| 16 |
+
STREAMLIT_BROWSER_GATHER_USAGE_STATS=false \
|
| 17 |
+
HF_HOME=/tmp/huggingface_cache
|
| 18 |
|
| 19 |
+
# Set working directory
|
| 20 |
+
WORKDIR $HOME/app
|
| 21 |
|
| 22 |
+
# Copy files as non-root user
|
| 23 |
+
COPY --chown=user . $HOME/app
|
| 24 |
|
| 25 |
+
# Install Python dependencies as non-root user
|
| 26 |
+
RUN pip install --no-cache-dir --user -r requirements.txt
|
| 27 |
|
| 28 |
+
# Switch to non-root user
|
| 29 |
+
USER user
|
| 30 |
|
| 31 |
+
# Expose Streamlit port (use 7860 for default HF Spaces, or specify app_port in README.md)
|
| 32 |
+
EXPOSE 7860
|
| 33 |
|
| 34 |
# Health check
|
| 35 |
+
HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1
|
| 36 |
|
| 37 |
+
# Run the app (adjust port to 7860 for HF Spaces default)
|
| 38 |
+
CMD ["streamlit", "run", "src/streamlit_app.py", "--server.port=7860", "--server.address=0.0.0.0"]
|