triflix commited on
Commit
4ecc196
·
verified ·
1 Parent(s): de8d72e

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +16 -7
Dockerfile CHANGED
@@ -1,21 +1,30 @@
1
  FROM python:3.10-slim
2
 
3
- # Install espeak-ng for G2P fallback
 
 
 
 
 
 
 
 
 
4
  RUN apt-get update && \
5
  apt-get install -y espeak-ng && \
6
  rm -rf /var/lib/apt/lists/*
7
 
8
  WORKDIR /app
9
 
10
- # Copy and install Python deps
11
- COPY requirements.txt .
12
  RUN pip install --no-cache-dir -r requirements.txt
13
 
14
- # Copy application code
15
  COPY . .
16
 
17
- # Expose the port that Spaces uses by default
18
  EXPOSE 7860
19
 
20
- # Start Uvicorn on port 7860
21
- CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
  FROM python:3.10-slim
2
 
3
+ # 1️⃣ Create writable cache directory for Hugging Face Hub
4
+ RUN mkdir -p /app/.cache/huggingface/hub && \
5
+ chown -R root:root /app/.cache/huggingface
6
+
7
+ # 2️⃣ Redirect HF cache environment variables
8
+ ENV HF_HOME=/app/.cache/huggingface \
9
+ HUGGINGFACE_HUB_CACHE=/app/.cache/huggingface/hub \
10
+ TRANSFORMERS_CACHE=/app/.cache/huggingface
11
+
12
+ # 3️⃣ Install system dependencies
13
  RUN apt-get update && \
14
  apt-get install -y espeak-ng && \
15
  rm -rf /var/lib/apt/lists/*
16
 
17
  WORKDIR /app
18
 
19
+ # 4️⃣ Install Python dependencies
20
+ COPY requirements.txt ./
21
  RUN pip install --no-cache-dir -r requirements.txt
22
 
23
+ # 5️⃣ Copy application code
24
  COPY . .
25
 
26
+ # 6️⃣ Expose Spaces default port
27
  EXPOSE 7860
28
 
29
+ # 7️⃣ Start the FastAPI application
30
+ CMD ["uvicorn", "main:app", "--host", "0.0.0.0", "--port", "7860"]