Spaces:
Sleeping
Sleeping
Enhance Dockerfile for improved network reliability and add cookies directory; update Streamlit app for better YouTube authentication handling and user guidance
a9b23f3
unverified
FROM python:3.9-slim | |
WORKDIR /app | |
# Install system dependencies including ffmpeg for audio processing | |
# Add retry logic and better mirrors for improved network reliability | |
RUN apt-get update --allow-releaseinfo-change || (sleep 2 && apt-get update) && \ | |
apt-get install -y \ | |
build-essential \ | |
curl \ | |
software-properties-common \ | |
git \ | |
ffmpeg \ | |
libsndfile1 \ | |
ca-certificates \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* | |
# Set pip to have more retries and timeout | |
ENV PIP_DEFAULT_TIMEOUT=100 | |
ENV PIP_RETRIES=3 | |
ENV PYTHONUNBUFFERED=1 | |
# Copy requirements and install Python dependencies | |
COPY requirements.txt ./ | |
RUN pip install --upgrade pip && \ | |
pip install --no-cache-dir -r requirements.txt || \ | |
(sleep 2 && pip install --no-cache-dir -r requirements.txt) | |
# Create cookies directory for user uploads | |
RUN mkdir -p /app/cookies | |
# Copy source code | |
COPY src/ ./src/ | |
# Create directory for temporary model storage | |
RUN mkdir -p /app/tmp_model | |
# Expose the port Streamlit will run on | |
EXPOSE 8501 | |
# Health check to ensure the service is running | |
HEALTHCHECK CMD curl --fail http://localhost:8501/_stcore/health | |
# Run the Streamlit app | |
ENTRYPOINT ["streamlit", "run", "src/streamlit_app.py", "--server.port=8501", "--server.address=0.0.0.0"] |