File size: 1,348 Bytes
2c2f938
 
 
 
 
 
 
768185a
2c2f938
 
768185a
3f097e5
768185a
2c2f938
 
3f097e5
 
 
 
768185a
 
 
 
 
 
2c2f938
 
768185a
2c2f938
 
 
768185a
2c2f938
 
 
 
 
 
 
 
 
 
 
768185a
 
 
 
2c2f938
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# =========================
# 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"]