khurrameycon commited on
Commit
6778b36
·
verified ·
1 Parent(s): b2ad3d9

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +18 -24
Dockerfile CHANGED
@@ -3,42 +3,36 @@ FROM python:3.9-slim
3
  # 1. Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
  espeak-ng \
 
6
  libsndfile1 \
7
- git
8
 
9
  # 2. Configure environment
10
- ENV HF_HOME=/app/cache \
11
- XDG_CACHE_HOME=/app/cache \
12
- PYTHONPATH="${PYTHONPATH}:/app"
13
-
14
- # 3. Create directories and set global permissions
15
- RUN mkdir -p /app/cache/hub/models--hexgrad--Kokoro-82M && \
16
- mkdir -p /app/cache/hub/.locks/models--hexgrad--Kokoro-82M && \
17
- mkdir -p /.local && \
18
- chmod -R 777 /app && \
19
- chmod -R 777 /.local && \
20
- chmod -R 777 /usr/local/lib/python3.9/site-packages
21
 
22
  WORKDIR /app
23
 
24
  # 4. Install Python dependencies
25
  COPY requirements.txt .
26
 
27
- # First install setup tools
28
- RUN pip install --upgrade pip setuptools wheel
29
 
30
- # Then install other requirements
31
- RUN pip install --no-cache-dir -r requirements.txt
32
 
33
- # Install spaCy model
34
- RUN python -m spacy download en_core_web_sm
35
- RUN pip install misaki[en]>=0.6.2 --no-cache-dir
36
- # Pre-download the model with explicit permissions
37
- RUN python -c "from huggingface_hub import hf_hub_download; hf_hub_download('hexgrad/Kokoro-82M', 'config.json')" || true && \
38
- chmod -R 777 /app/cache
39
 
40
- # 5. Copy application code
41
  COPY . .
42
 
43
- # 6. Run FastAPI
44
  CMD uvicorn app:app --host 0.0.0.0 --port 7860
 
3
  # 1. Install system dependencies
4
  RUN apt-get update && apt-get install -y \
5
  espeak-ng \
6
+ git \
7
  libsndfile1 \
8
+ curl
9
 
10
  # 2. Configure environment
11
+ ENV PYTHONUNBUFFERED=1 \
12
+ HF_HOME=/app/cache \
13
+ PYTHONPATH="/app"
14
+
15
+ # 3. Create cache directory with permissions
16
+ RUN mkdir -p /app/cache && \
17
+ chmod -R 777 /app/cache
 
 
 
 
18
 
19
  WORKDIR /app
20
 
21
  # 4. Install Python dependencies
22
  COPY requirements.txt .
23
 
24
+ RUN pip install --upgrade pip setuptools wheel && \
25
+ pip install --no-cache-dir -r requirements.txt
26
 
27
+ # 5. Install misaki from source (with data files)
28
+ RUN pip install git+https://github.com/hexgrad/misaki.git --no-cache-dir
29
 
30
+ # 6. Fix PulseAudio warnings
31
+ RUN mkdir -p /.config/pulse && \
32
+ chmod -R 777 /.config
 
 
 
33
 
34
+ # 7. Copy application code
35
  COPY . .
36
 
37
+ # 8. Run FastAPI
38
  CMD uvicorn app:app --host 0.0.0.0 --port 7860