triflix commited on
Commit
58398cb
·
verified ·
1 Parent(s): 092767a

Update Dockerfile

Browse files
Files changed (1) hide show
  1. Dockerfile +25 -21
Dockerfile CHANGED
@@ -1,32 +1,36 @@
1
- # Use official slim Python 3.12 image
2
  FROM python:3.12-slim
3
 
4
- # Set working directory
 
 
 
 
 
 
5
  WORKDIR /app
6
 
7
- # Copy app code
8
  COPY app.py .
9
 
10
- # Set environment variables for writable caches
11
- ENV HF_HOME=/tmp/hf_cache
12
- ENV TRANSFORMERS_CACHE=/tmp/hf_cache
13
- ENV PIP_CACHE_DIR=/tmp/pip_cache
14
- ENV PIP_NO_CACHE_DIR=off
15
-
16
- # Upgrade pip
17
- RUN python -m pip install --upgrade pip
18
-
19
- # Install dependencies
20
- # Remove en-core-web-sm from pip, install via spacy download if needed at runtime
21
- RUN pip install --no-cache-dir \
22
- torch \
23
  soundfile \
24
  fastapi \
25
  uvicorn \
26
- kokoro
 
 
 
27
 
28
- # Expose FastAPI port
29
- EXPOSE 7860
30
 
31
- # Launch FastAPI app
32
- CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]
 
1
+ # Use a slim Python 3.12 base image
2
  FROM python:3.12-slim
3
 
4
+ # Set environment variables to suppress warnings and ensure non-interactive installs
5
+ ENV PYTHONUNBUFFERED=1 \
6
+ PIP_NO_CACHE_DIR=1 \
7
+ TRANSFORMERS_CACHE=/tmp/transformers_cache \
8
+ HF_HOME=/tmp/huggingface_cache
9
+
10
+ # Set the working directory inside the container
11
  WORKDIR /app
12
 
13
+ # Copy the application code into the container
14
  COPY app.py .
15
 
16
+ # Install system dependencies and Python packages
17
+ RUN apt-get update && apt-get install -y \
18
+ espeak-ng \
19
+ build-essential \
20
+ && rm -rf /var/lib/apt/lists/* \
21
+ && python -m pip install --upgrade pip \
22
+ && pip install --no-cache-dir \
23
+ torch==2.9.0 \
 
 
 
 
 
24
  soundfile \
25
  fastapi \
26
  uvicorn \
27
+ spacy \
28
+ && python -m spacy download en_core_web_sm==3.8.0 \
29
+ && pip install --no-cache-dir \
30
+ kokoro==0.9.4
31
 
32
+ # Expose the port the app runs on
33
+ EXPOSE 7860
34
 
35
+ # Command to run the application
36
+ CMD ["uvicorn", "app:app", "--host", "0.0.0.0", "--port", "7860"]