FROM python:3.10-slim # System dependencies RUN apt-get update && apt-get install -y --no-install-recommends \ ffmpeg \ libsndfile1 \ libportaudio2 \ git \ build-essential \ && rm -rf /var/lib/apt/lists/* WORKDIR /app # Install torch CPU first (before anything else) RUN pip install --no-cache-dir torch==2.1.2 torchaudio==2.1.2 --index-url https://download.pytorch.org/whl/cpu # Clone Applio for RVC inference RUN git clone --depth 1 https://github.com/IAHispano/Applio.git /app/applio # Remove torch pin from Applio requirements (we already have torch) RUN cd /app/applio && sed -i '/^torch/d' requirements.txt # Install Applio requirements RUN cd /app/applio && pip install --no-cache-dir -r requirements.txt || true # Ensure critical packages are installed RUN pip install --no-cache-dir \ numpy==1.24.3 \ faiss-cpu \ torchcrepe \ torchfcpe \ praat-parselmouth \ pyworld \ fairseq==0.12.2 \ huggingface_hub \ edge-tts \ gradio==4.44.1 \ soundfile \ librosa # Download Applio prerequisites (pretrained models for inference) RUN cd /app/applio && python core.py prerequisites || true COPY app.py /app/app.py # Create a non-root user RUN useradd -m -u 1000 user # Give user write access to temp and model dirs RUN mkdir -p /app/temp /app/models && chown -R user:user /app/temp /app/models /app/applio/logs USER user ENV HOME=/home/user \ PATH=/home/user/.local/bin:$PATH \ GRADIO_SERVER_NAME=0.0.0.0 \ PYTHONPATH=/app/applio:/app/applio/rvc/train EXPOSE 7860 CMD ["python", "app.py"]