FROM python:3.12-slim # Set environment variables to prevent Python from writing pyc files to disk # and to force stdout and stderr streams to be unbuffered ENV PYTHONDONTWRITEBYTECODE=1 ENV PYTHONUNBUFFERED=1 # Install system dependencies RUN apt-get update && apt-get install -y \ ffmpeg \ gcc \ libasound-dev \ portaudio19-dev \ && rm -rf /var/lib/apt/lists/* # Create and set the working directory WORKDIR /app # Copy the requirements.txt file and install the Python dependencies COPY requirements.txt . RUN pip install --no-cache-dir -r requirements.txt # Copy the rest of the application code COPY . . # Expose the port that the FastAPI app runs on EXPOSE 7860 # Run the FastAPI application with Uvicorn CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]