Spaces:
Sleeping
Sleeping
Update Dockerfile
Browse files- Dockerfile +19 -5
Dockerfile
CHANGED
|
@@ -1,7 +1,12 @@
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
|
|
|
| 3 |
WORKDIR /app
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
ENV STREAMLIT_HOME="/app/.streamlit"
|
| 6 |
ENV XDG_CONFIG_HOME="/app/.config"
|
| 7 |
ENV XDG_CACHE_HOME="/app/.cache"
|
|
@@ -9,22 +14,31 @@ ENV MPLCONFIGDIR="/app/.config/matplotlib"
|
|
| 9 |
ENV HF_HOME="/app/.hf_home"
|
| 10 |
ENV HF_HUB_CACHE="/app/.hf_home/hub_cache"
|
| 11 |
|
| 12 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 13 |
RUN apt-get update && apt-get install -y \
|
| 14 |
build-essential \
|
| 15 |
curl \
|
| 16 |
software-properties-common \
|
| 17 |
git \
|
|
|
|
|
|
|
|
|
|
| 18 |
&& rm -rf /var/lib/apt/lists/*
|
| 19 |
|
|
|
|
| 20 |
COPY requirements.txt ./
|
| 21 |
COPY src/ ./src/
|
| 22 |
|
|
|
|
| 23 |
RUN pip3 install -r requirements.txt
|
| 24 |
-
RUN apt-get update && apt-get install ffmpeg libsm6 libxext6 -y
|
| 25 |
|
|
|
|
| 26 |
EXPOSE 8501
|
| 27 |
-
|
| 28 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 29 |
|
| 30 |
-
|
|
|
|
|
|
| 1 |
FROM python:3.10-slim
|
| 2 |
|
| 3 |
+
# Set working dir
|
| 4 |
WORKDIR /app
|
| 5 |
+
|
| 6 |
+
# 🔥 This is the key line to avoid permission errors
|
| 7 |
+
ENV HOME="/app"
|
| 8 |
+
|
| 9 |
+
# Set up environment variables to redirect all known cache/config paths
|
| 10 |
ENV STREAMLIT_HOME="/app/.streamlit"
|
| 11 |
ENV XDG_CONFIG_HOME="/app/.config"
|
| 12 |
ENV XDG_CACHE_HOME="/app/.cache"
|
|
|
|
| 14 |
ENV HF_HOME="/app/.hf_home"
|
| 15 |
ENV HF_HUB_CACHE="/app/.hf_home/hub_cache"
|
| 16 |
|
| 17 |
+
# Create all needed directories with proper permissions
|
| 18 |
+
RUN mkdir -p /app/.streamlit /app/.config/matplotlib /app/.cache /app/.hf_home/hub_cache \
|
| 19 |
+
&& chmod -R 777 /app
|
| 20 |
+
|
| 21 |
+
# Install dependencies
|
| 22 |
RUN apt-get update && apt-get install -y \
|
| 23 |
build-essential \
|
| 24 |
curl \
|
| 25 |
software-properties-common \
|
| 26 |
git \
|
| 27 |
+
ffmpeg \
|
| 28 |
+
libsm6 \
|
| 29 |
+
libxext6 \
|
| 30 |
&& rm -rf /var/lib/apt/lists/*
|
| 31 |
|
| 32 |
+
# Copy app files
|
| 33 |
COPY requirements.txt ./
|
| 34 |
COPY src/ ./src/
|
| 35 |
|
| 36 |
+
# Install Python dependencies
|
| 37 |
RUN pip3 install -r requirements.txt
|
|
|
|
| 38 |
|
| 39 |
+
# Expose port and healthcheck
|
| 40 |
EXPOSE 8501
|
|
|
|
| 41 |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health
|
| 42 |
|
| 43 |
+
# Run Streamlit app
|
| 44 |
+
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"]
|