| # Step 1: Use a specific Python version | |
| FROM python:3.9 | |
| # Step 2: Install system-level dependencies | |
| # We need ffmpeg for your audio processing in ml_logic.py | |
| RUN apt-get update && apt-get install -y ffmpeg | |
| # Step 3: Set up the working directory inside the container | |
| WORKDIR /app | |
| # Step 4: Copy dependency file and install Python packages | |
| # This is done first to leverage Docker's layer caching | |
| COPY requirements.txt ./ | |
| RUN pip install --no-cache-dir -r requirements.txt | |
| # Step 5: Copy all your application code into the container | |
| COPY . . | |
| # Step 6: Expose the port your app will run on | |
| # Hugging Face Spaces uses port 7860 by default for web apps | |
| EXPOSE 7860 | |
| # Step 7: Define the command to run your application | |
| # We use gunicorn to run your Flask app created by create_app in run.py | |
| # We bind it to 0.0.0.0 so it's accessible from outside the container. | |
| CMD ["gunicorn", "--bind", "0.0.0.0:7860", "run:app"] |