# Use Python 3.10 slim image FROM python:3.10-slim # Set working directory WORKDIR /app # Install system dependencies RUN apt-get update && apt-get install -y \ build-essential \ ffmpeg \ libsndfile1 \ sox \ && rm -rf /var/lib/apt/lists/* # === STEP 1: Manually install gradio and a compatible websockets version === # This step ensures that a compatible version of websockets is installed # without any interference from other packages. RUN pip install --no-cache-dir "gradio==4.25.0" "websockets>=10.0,<13.0" # Copy requirements.txt COPY requirements.txt . # === STEP 2: Install remaining dependencies === # Now install the rest of your dependencies. These are less likely to # cause issues with gradio since it's already installed. RUN pip install --no-cache-dir -r requirements.txt # === FINAL STEP: A check to ensure websockets is present === RUN python -c "import websockets.asyncio.client; print('✅ websockets.asyncio.client is available')" # Copy app files COPY backend.py app.py ./ # Expose port EXPOSE 7860 # Run app CMD ["python", "app.py"]