File size: 1,082 Bytes
e27510b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# 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"]