# ========================= # Dockerfile cho app Gradio âm thanh # ========================= # Base image Python nhẹ và ổn định FROM python:3.10-slim # Tránh interactive prompts và giảm layer size ENV DEBIAN_FRONTEND=noninteractive ENV PYTHONUNBUFFERED=1 ENV MPLBACKEND=Agg # Matplotlib backend không GUI # Cài các dependencies hệ thống cần thiết cho audio và TensorFlow RUN apt-get update && \ apt-get install -y --no-install-recommends \ ffmpeg \ libsndfile1 \ build-essential \ wget \ python3-dev \ libatlas-base-dev \ gfortran \ liblapack-dev \ libblas-dev \ curl \ && rm -rf /var/lib/apt/lists/* # Thiết lập thư mục làm việc WORKDIR /app COPY . /app # Cài các package Python nhẹ trước RUN pip install --no-cache-dir \ gradio==4.26.0 \ numpy<2 \ librosa==0.10.1 \ matplotlib \ pywavelets \ scikit-learn \ joblib \ imageio \ pillow # Cài TensorFlow riêng để tránh lỗi build RUN pip install --no-cache-dir tensorflow==2.11.0 # Nếu bạn cần Demucs / Silero VAD / torch # RUN pip install --no-cache-dir torch==1.13.1 torchaudio==0.13.1 demucs==4.0.1 silero-vad==5.1.2 soundfile # Expose port Gradio EXPOSE 7860 # Command chạy app CMD ["python", "appy.py"]