moustafa1-1 commited on
Commit
fc52d6c
·
verified ·
1 Parent(s): b5c85d9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -25
Dockerfile CHANGED
@@ -1,19 +1,10 @@
 
1
  FROM python:3.9-slim-buster
2
 
3
- # Install Git (if not already included)
4
- RUN apt-get update && apt-get install -y git
5
-
6
  # Set the working directory in the container
7
  WORKDIR /app
8
 
9
- # Copy your entire repository content (including .git, .gitmodules, TTS as a submodule pointer)
10
- COPY . /app/
11
-
12
- # Initialize and update submodules
13
- RUN git submodule init
14
- RUN git submodule update
15
-
16
- # Install build tools and other dependencies AFTER submodule update
17
  RUN apt-get update && apt-get install -y --no-install-recommends \
18
  build-essential \
19
  cmake \
@@ -21,10 +12,22 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
21
  libblis-dev \
22
  python3-venv \
23
  python3-dev \
24
- wget \
25
- libopenblas-dev
 
 
26
 
27
- # Set the working directory to the TTS directory AFTER updating submodules
 
 
 
 
 
 
 
 
 
 
28
  WORKDIR /app/TTS
29
 
30
  # Set a generic architecture flag
@@ -33,16 +36,16 @@ ENV BLIS_ARCH="generic"
33
  # Try to agree to the Coqui TTS license via environment variable
34
  ENV COQUI_TTS_AGREED=1
35
 
36
- # Create and activate the virtual environment, then install TTS requirements and the TTS package
37
- RUN python3 -m venv venv && \
38
- . venv/bin/activate && \
39
- pip install -r requirements.txt --timeout=300 && \
40
- pip install -e . --timeout=300
41
 
42
  # Change working directory back to /app
43
  WORKDIR /app
44
 
45
- # Create the model directory
46
  RUN mkdir -p /app/models/xtts_v2
47
 
48
  # Download XTTS v2 model files
@@ -54,8 +57,7 @@ RUN wget -O /app/models/xtts_v2/speakers_xtts.pth https://huggingface.co/coqui/X
54
 
55
  # Create the audio directory if it doesn't exist
56
  RUN mkdir -p /app/audio
57
-
58
- # Copy the speaker_reference.wav file if it exists at the root
59
  COPY speaker_reference.wav /app/audio/speaker_reference.wav
60
 
61
  # Copy the web page files
@@ -66,9 +68,7 @@ COPY local_server_new.py /app/
66
 
67
  # Install your other dependencies (fastapi, uvicorn, bangla, etc.)
68
  COPY requirements.txt /app/
69
- RUN python3 -m venv /app/venv && \
70
- . /app/venv/bin/activate && \
71
- pip install -r /app/requirements.txt --no-cache-dir --timeout=300
72
 
73
  # Create start.sh script
74
  RUN echo "#!/bin/bash" > start.sh && \
 
1
+ # Use an official Python runtime as a parent image
2
  FROM python:3.9-slim-buster
3
 
 
 
 
4
  # Set the working directory in the container
5
  WORKDIR /app
6
 
7
+ # Install build tools and other dependencies
 
 
 
 
 
 
 
8
  RUN apt-get update && apt-get install -y --no-install-recommends \
9
  build-essential \
10
  cmake \
 
12
  libblis-dev \
13
  python3-venv \
14
  python3-dev \
15
+ wget
16
+
17
+ # Copy the repository content (including .gitmodules and TTS pointer)
18
+ COPY . /app/
19
 
20
+ # Initialize and update submodules
21
+ RUN git submodule init
22
+ RUN git submodule update
23
+
24
+ # Create a virtual environment
25
+ RUN python3 -m venv venv
26
+
27
+ # Activate the virtual environment
28
+ RUN . /app/venv/bin/activate
29
+
30
+ # Set the working directory to the TTS directory
31
  WORKDIR /app/TTS
32
 
33
  # Set a generic architecture flag
 
36
  # Try to agree to the Coqui TTS license via environment variable
37
  ENV COQUI_TTS_AGREED=1
38
 
39
+ # Install Coqui TTS requirements
40
+ RUN . /app/venv/bin/activate && pip install -r requirements.txt --timeout=300
41
+
42
+ # Explicitly install the TTS package itself in editable mode
43
+ RUN . /app/venv/bin/activate && pip install -e . --timeout=300
44
 
45
  # Change working directory back to /app
46
  WORKDIR /app
47
 
48
+ # Create the model directory (relative to /app)
49
  RUN mkdir -p /app/models/xtts_v2
50
 
51
  # Download XTTS v2 model files
 
57
 
58
  # Create the audio directory if it doesn't exist
59
  RUN mkdir -p /app/audio
60
+ # Copy the speaker reference file from the root directory
 
61
  COPY speaker_reference.wav /app/audio/speaker_reference.wav
62
 
63
  # Copy the web page files
 
68
 
69
  # Install your other dependencies (fastapi, uvicorn, bangla, etc.)
70
  COPY requirements.txt /app/
71
+ RUN . /app/venv/bin/activate && pip install -r /app/requirements.txt --no-cache-dir --timeout=300
 
 
72
 
73
  # Create start.sh script
74
  RUN echo "#!/bin/bash" > start.sh && \