FROM python:3.10-slim WORKDIR /app # Install system packages RUN apt-get update && apt-get install -y \ build-essential \ curl \ git \ ffmpeg \ libsndfile1 \ cmake \ libopenblas-dev \ && rm -rf /var/lib/apt/lists/* # === CRITICAL FIX + PERFORMANCE OPTIMIZATIONS === # Set Streamlit to use temporary directories for ALL storage ENV HOME=/tmp ENV STREAMLIT_GLOBAL_DEVELOPMENT_MODE=false ENV STREAMLIT_GLOBAL_DATA_PATH=/tmp ENV STREAMLIT_CONFIG_DIR=/tmp/.streamlit ENV HF_HOME=/tmp/huggingface # Create directories with open permissions including static audio directory RUN mkdir -p /tmp/.streamlit /tmp/huggingface /app/static && \ chmod -R 777 /tmp /app/static # Create config file with proper settings for large file handling RUN mkdir -p /tmp/.streamlit && \ cat < /tmp/.streamlit/config.toml [browser] gatherUsageStats = false [server] enableCORS = false enableXsrfProtection = false maxUploadSize = 500 maxMessageSize = 500 [runner] maxCachedEntries = 1000 fastReruns = true EOF # Copy files COPY requirements.txt ./ COPY src/ ./src/ COPY static/ ./static/ # Install Python dependencies RUN pip3 install --no-cache-dir -r requirements.txt EXPOSE 8501 HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", \ "--server.port=8501", \ "--server.address=0.0.0.0", \ "--server.maxUploadSize=500", \ "--server.maxMessageSize=500"]