puzan789 commited on
Commit
6375da0
·
1 Parent(s): cad1ad0
Files changed (2) hide show
  1. Dockerfile +15 -6
  2. requirements.txt +2 -0
Dockerfile CHANGED
@@ -1,13 +1,19 @@
1
- # Use a base image with Python
2
  FROM python:3.9-slim
3
 
4
- # Set the working directory inside the container
5
  WORKDIR /app
6
 
7
- # Install system dependencies required for PyAudio and ffmpeg
8
  RUN apt-get update && \
9
- apt-get install -y python3-dev portaudio19-dev gcc ffmpeg && \
10
- rm -rf /var/lib/apt/lists/*
 
 
 
 
 
 
11
 
12
  # Copy application files into the container
13
  COPY . .
@@ -15,8 +21,11 @@ COPY . .
15
  # Install Python dependencies
16
  RUN pip install --no-cache-dir -r requirements.txt
17
 
18
- # Expose the necessary port (modify if needed)
19
  EXPOSE 7860
20
 
 
 
 
21
  # Set the default command to run the application
22
  CMD ["python", "app.py"]
 
1
+ # Use a slim Python image
2
  FROM python:3.9-slim
3
 
4
+ # Set the working directory
5
  WORKDIR /app
6
 
7
+ # Install system dependencies required for PyAudio, ffmpeg, and virtual audio devices
8
  RUN apt-get update && \
9
+ apt-get install -y \
10
+ python3-dev portaudio19-dev ffmpeg \
11
+ alsa-utils alsa-oss alsa-tools pulseaudio \
12
+ && rm -rf /var/lib/apt/lists/*
13
+
14
+ # Set up a virtual audio device (for environments without physical audio hardware)
15
+ RUN echo "pcm.!default { type hw card 0 }" > /etc/asound.conf && \
16
+ echo "ctl.!default { type hw card 0 }" >> /etc/asound.conf
17
 
18
  # Copy application files into the container
19
  COPY . .
 
21
  # Install Python dependencies
22
  RUN pip install --no-cache-dir -r requirements.txt
23
 
24
+ # Expose the necessary port
25
  EXPOSE 7860
26
 
27
+ # Set environment variable to ensure PyAudio works
28
+ ENV PULSE_SERVER unix:/run/user/1000/pulse/native
29
+
30
  # Set the default command to run the application
31
  CMD ["python", "app.py"]
requirements.txt CHANGED
@@ -10,3 +10,5 @@ Requests
10
  streamlit
11
  uvicorn
12
  langchain-community
 
 
 
10
  streamlit
11
  uvicorn
12
  langchain-community
13
+ pyaudio
14
+ sounddevice