Jacky2305 commited on
Commit
fe98bd4
·
1 Parent(s): 700e324

Fix Dockerfile: add retry logic for apt-get and pip install

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -15
Dockerfile CHANGED
@@ -4,31 +4,41 @@ ENV DEBIAN_FRONTEND=noninteractive
4
  ENV PIP_NO_CACHE_DIR=1
5
  ENV PYTHONUNBUFFERED=1
6
 
7
- # Install system dependencies
8
- RUN apt-get update && apt-get install -y --no-install-recommends \
9
- git \
10
- ffmpeg \
11
- libsndfile1 \
12
- libportaudio2 \
13
- libasound2 \
14
- build-essential \
15
- cmake \
16
- && rm -rf /var/lib/apt/lists/*
 
 
 
17
 
18
  WORKDIR /app
19
 
20
  # Install Python dependencies
21
  COPY requirements.txt .
22
- RUN pip install --no-cache-dir -r requirements.txt
23
 
24
- # Install RVC (Retrieval-based Voice Conversion) from source
25
- RUN git clone https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git /app/rvc \
26
- && cd /app/rvc \
27
- && pip install --no-cache-dir -r requirements.txt
 
 
 
28
 
29
  # Copy application files
30
  COPY app.py .
31
  COPY inference.py .
 
 
 
 
32
 
33
  EXPOSE 7860
34
 
 
4
  ENV PIP_NO_CACHE_DIR=1
5
  ENV PYTHONUNBUFFERED=1
6
 
7
+ # Install system dependencies with retry logic
8
+ RUN for i in 1 2 3; do \
9
+ apt-get update && apt-get install -y --no-install-recommends \
10
+ git \
11
+ ffmpeg \
12
+ libsndfile1 \
13
+ libportaudio2 \
14
+ libasound2 \
15
+ build-essential \
16
+ cmake \
17
+ && rm -rf /var/lib/apt/lists/* \
18
+ && break || sleep 10; \
19
+ done
20
 
21
  WORKDIR /app
22
 
23
  # Install Python dependencies
24
  COPY requirements.txt .
25
+ RUN pip install --no-cache-dir --timeout=300 -r requirements.txt
26
 
27
+ # Install RVC from source with retry
28
+ RUN for i in 1 2 3; do \
29
+ git clone --depth 1 https://github.com/RVC-Project/Retrieval-based-Voice-Conversion-WebUI.git /app/rvc \
30
+ && cd /app/rvc \
31
+ && pip install --no-cache-dir --timeout=300 -r requirements.txt \
32
+ && break || sleep 15; \
33
+ done
34
 
35
  # Copy application files
36
  COPY app.py .
37
  COPY inference.py .
38
+ COPY download_models.py .
39
+
40
+ # Run model download/setup
41
+ RUN python download_models.py
42
 
43
  EXPOSE 7860
44