FROM python:3.10 # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ git \ git-lfs \ ffmpeg \ libsm6 \ libxext6 \ cmake \ rsync \ libgl1 \ libcairo2-dev \ pkg-config \ python3-dev \ libpango1.0-dev \ texlive-latex-recommended \ texlive-fonts-recommended \ texlive-latex-extra \ fonts-dejavu-core \ libsndfile1 \ && rm -rf /var/lib/apt/lists/* \ && git lfs install # Upgrade pip RUN pip install --no-cache-dir pip -U # Install HuggingFace dependencies RUN pip install --no-cache-dir \ datasets \ "huggingface-hub>=0.30" \ "hf-transfer>=0.1.4" \ "protobuf<4" \ "click<8.1" \ "pydantic~=1.0" # Copy requirements and install Python dependencies COPY requirements.txt /app/requirements.txt RUN pip install --no-cache-dir -r /app/requirements.txt # Install Streamlit and required packages RUN pip install --no-cache-dir \ streamlit==1.42.0 \ "uvicorn>=0.14.0" \ spaces # Copy application files COPY . /app # Create necessary directories RUN mkdir -p .streamlit && \ git config --global core.excludesfile ~/.gitignore && \ echo ".streamlit" > ~/.gitignore # Create user directory RUN mkdir -p /home/user && \ ( [ -e /home/user/app ] || ln -s /app/ /home/user/app ) || true # Expose port EXPOSE 7860 # Set environment variables ENV GRADIO_SERVER_NAME="0.0.0.0" ENV STREAMLIT_SERVER_PORT=7860 ENV STREAMLIT_SERVER_ADDRESS=0.0.0.0 # Health check HEALTHCHECK CMD curl --fail http://localhost:7860/_stcore/health || exit 1 # Run the application CMD ["streamlit", "run", "app.py", "--server.port=7860", "--server.address=0.0.0.0"]