# Use the Hugging Face Spaces base image FROM huggingface/platform:latest # Install system dependencies for PyAudio, PulseAudio, and other build tools RUN apt-get update && apt-get install -y \ portaudio19-dev \ libasound-dev \ libportaudio2 \ libportaudiocpp0 \ pulseaudio \ gcc \ && apt-get clean # Set up a virtual microphone using PulseAudio RUN mkdir -p /etc/pulse RUN echo "default-server = unix:/tmp/pulseaudio.socket" > /etc/pulse/client.conf RUN echo "autospawn = no" >> /etc/pulse/client.conf RUN echo "daemon-binary = /bin/true" >> /etc/pulse/client.conf RUN echo "enable-shm = false" >> /etc/pulse/client.conf # Create a PulseAudio socket RUN mkdir -p /tmp/pulse RUN chmod 777 /tmp/pulse # Start PulseAudio in the background RUN pulseaudio -D --exit-idle-time=-1 # Create a virtual microphone RUN pactl load-module module-null-sink sink_name=virtual_mic RUN pactl load-module module-virtual-source source_name=virtual_mic.monitor # Set the working directory inside the container WORKDIR /app # Copy all project files into the container COPY . /app # Install Python dependencies RUN pip install --no-cache-dir -r requirements.txt # Expose the Streamlit default port EXPOSE 8501 # Run the Streamlit app CMD ["streamlit", "run", "app.py", "--server.port=8501", "--server.address=0.0.0.0"]