# Use an official Python runtime as a base image FROM python:3.10 # Set the working directory in the container WORKDIR /app # Install system dependencies RUN apt-get update && \ apt-get install -y ffmpeg libsndfile1 && \ rm -rf /var/lib/apt/lists/* # Copy the requirements file and install Python dependencies COPY requirements.txt /app/ RUN pip install --no-cache-dir -r requirements.txt # Clone the necessary external repositories RUN git clone https://github.com/reazon-research/ReazonSpeech /app/ReazonSpeech # Install local packages from the cloned repository RUN pip install --no-warn-conflicts /app/ReazonSpeech/pkg/nemo-asr RUN pip install /app/ReazonSpeech/pkg/nemo-asr # Create directories for caches and set permissions RUN mkdir -p /app/cache/huggingface /app/cache/modelscope /app/cache/matplotlib /app/cache/fontconfig /app/cache/lhotse && \ chmod -R 777 /app/cache # Set environment variables for cache directories and application configuration ENV TRANSFORMERS_CACHE=/app/cache/huggingface ENV HF_HOME=/app/cache/huggingface ENV MODELSCOPE_CACHE=/app/cache/modelscope ENV MPLCONFIGDIR=/app/cache/matplotlib ENV FONTCONFIG_PATH=/app/cache/fontconfig ENV LHOTSE_CACHE=/app/cache/lhotse ENV PYTHONUNBUFFERED=1 # Copy the rest of the application source code COPY . /app # Expose the port the app runs on EXPOSE 7860 # Define environment variables for the Uvicorn command if necessary ENV MODULE_NAME="app.main" ENV VARIABLE_NAME="app" ENV PORT=7860 # Run the app using Uvicorn CMD ["uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "7860"]