Spaces:
Sleeping
Sleeping
| FROM python:3.10-slim | |
| # Set working dir | |
| WORKDIR /app | |
| # 🔥 This is the key line to avoid permission errors | |
| ENV HOME="/app" | |
| # Set up environment variables to redirect all known cache/config paths | |
| ENV STREAMLIT_HOME="/app/.streamlit" | |
| ENV XDG_CONFIG_HOME="/app/.config" | |
| ENV XDG_CACHE_HOME="/app/.cache" | |
| ENV MPLCONFIGDIR="/app/.config/matplotlib" | |
| ENV HF_HOME="/app/.hf_home" | |
| ENV HF_HUB_CACHE="/app/.hf_home/hub_cache" | |
| # Create all needed directories with proper permissions | |
| RUN mkdir -p /app/.streamlit /app/.config/matplotlib /app/.cache /app/.hf_home/hub_cache \ | |
| && chmod -R 777 /app | |
| # Install dependencies | |
| RUN apt-get update && apt-get install -y \ | |
| build-essential \ | |
| curl \ | |
| software-properties-common \ | |
| git \ | |
| ffmpeg \ | |
| libsm6 \ | |
| libxext6 \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy app files | |
| COPY requirements.txt ./ | |
| COPY src/ ./src/ | |
| # Install Python dependencies | |
| RUN pip3 install -r requirements.txt | |
| # Expose port and healthcheck | |
| EXPOSE 8501 | |
| HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health | |
| # Run Streamlit app | |
| ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] |