Spaces:
Sleeping
Sleeping
| # Use a lightweight, official Python 3.10 image as the base | |
| FROM python:3.10-slim | |
| # Set the working directory inside the container | |
| WORKDIR /app | |
| # Install critical system dependencies for audio processing | |
| # - libsndfile1 is required by soundfile/librosa to read wav/mp3 files | |
| # - ffmpeg is required by gTTS and Gradio for audio format conversion | |
| # - build-essential is often needed to compile certain Python C-extensions | |
| RUN apt-get update && apt-get install -y \ | |
| libsndfile1 \ | |
| ffmpeg \ | |
| build-essential \ | |
| && rm -rf /var/lib/apt/lists/* | |
| # Copy the requirements file first to leverage Docker cache | |
| COPY requirements.txt . | |
| # Install the Python dependencies | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Copy all the application files (main.py, backend.py, visualization.py) into the container | |
| COPY . . | |
| # Expose the port that Gradio uses by default | |
| EXPOSE 7860 | |
| # Set environment variables for Gradio to run cleanly in Docker | |
| # Setting SERVER_NAME to 0.0.0.0 allows external access to the container | |
| ENV GRADIO_SERVER_NAME="0.0.0.0" | |
| ENV GRADIO_SERVER_PORT=7860 | |
| # Command to run the application | |
| CMD ["python", "main.py"] |